mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-21 19:22:05 +00:00
Secure cookies merge into global xCAT team UI. A few other changes also.
Change-Id: I529160b9e2c31c86aca7c2c1ad32559c43ab4aea
This commit is contained in:
parent
d97f844b99
commit
e413f23264
@ -1,5 +1,12 @@
|
||||
Alias /xcat "/opt/xcat/ui"
|
||||
PHPINIDir "/opt/xcat/ui"
|
||||
|
||||
# Redirect all http request to https
|
||||
RewriteEngine On
|
||||
RewriteCond %{SERVER_PORT} 80
|
||||
RewriteCond %{HTTPS} !=on
|
||||
RewriteRule ^/?xcat/(.*) https://%{SERVER_NAME}/xcat/$1 [R,L]
|
||||
|
||||
<Directory "/opt/xcat/ui">
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
|
@ -60,7 +60,7 @@ function loadServicePage(tabId) {
|
||||
title = 'z/VM';
|
||||
|
||||
// Get zVM host names
|
||||
if (!$.cookie('zvms')){
|
||||
if (!$.cookie('xcat_zvms')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
|
@ -39,7 +39,7 @@ function loadUpdatePage() {
|
||||
|
||||
/**
|
||||
* Show the RPM repository (it can use the user's last choice and input)
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showRepository(data) {
|
||||
@ -61,7 +61,7 @@ function showRepository(data) {
|
||||
|
||||
// Display the Devel Repository, remember user's last selection
|
||||
show = show + "<li><input type='radio' ";
|
||||
if ($.cookie('xcatrepository') == 1) {
|
||||
if ($.cookie('xcat_repository') == 1) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + develRepository + "'>";
|
||||
@ -70,7 +70,7 @@ function showRepository(data) {
|
||||
|
||||
// Display the Stable Repository, remember user's last selection
|
||||
show = "<li><input type='radio' ";
|
||||
if ($.cookie('xcatrepository') == 2) {
|
||||
if ($.cookie('xcat_repository') == 2) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + stableRepository + "' checked='true'>";
|
||||
@ -78,23 +78,23 @@ function showRepository(data) {
|
||||
repoList.append(show);
|
||||
|
||||
// Display the Input Repository, remember user's last selection
|
||||
if (($.cookie('xcatrepository')) && ($.cookie('xcatrepository') != 1)
|
||||
&& ($.cookie('xcatrepository') != 2)) {
|
||||
if (($.cookie('xcat_repository')) && ($.cookie('xcat_repository') != 1)
|
||||
&& ($.cookie('xcat_repository') != 2)) {
|
||||
show = "<li><input type='radio' checked='true' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value='"
|
||||
+ $.cookie('xcatrepository') + "'</li>";
|
||||
+ $.cookie('xcat_repository') + "'</li>";
|
||||
} else {
|
||||
show = "<li><input type='radio' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value=''</li>";
|
||||
}
|
||||
repoList.append(show);
|
||||
|
||||
|
||||
$('#repository fieldset').append(repoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all xCAT RPMs
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showRpmInfo(data) {
|
||||
@ -109,7 +109,7 @@ function showRpmInfo(data) {
|
||||
}
|
||||
|
||||
rpms = data.rsp.split(/\n/);
|
||||
|
||||
|
||||
// No rpm installed, return
|
||||
if (1 > rpms.length) {
|
||||
$('#rpm fieldset').append("No RPMs installed!");
|
||||
@ -201,7 +201,7 @@ function updateRpm() {
|
||||
if (pattern.test(rpms)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
rpms = rpms + temp + ",";
|
||||
});
|
||||
|
||||
@ -227,8 +227,9 @@ function updateRpm() {
|
||||
}
|
||||
|
||||
// Remember users' choice and input
|
||||
$.cookie('xcatrepository', rpmPathType, {
|
||||
$.cookie('xcat_repository', rpmPathType, {
|
||||
path : '/xcat',
|
||||
secure : true,
|
||||
expires : 10
|
||||
});
|
||||
|
||||
@ -255,7 +256,7 @@ function updateRpm() {
|
||||
|
||||
/**
|
||||
* Show the results of the RPM update
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showUpdateResult(data) {
|
||||
|
@ -14,14 +14,14 @@ var bladePlugin = function() {
|
||||
|
||||
/**
|
||||
* Load node inventory
|
||||
*
|
||||
*
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
bladePlugin.prototype.loadInventory = function(data) {
|
||||
var args = data.msg.split(',');
|
||||
var tabId = args[0].replace('out=', '');
|
||||
var node = args[1].replace('node=', '');
|
||||
|
||||
|
||||
// Get node inventory
|
||||
var inv = data.rsp;
|
||||
|
||||
@ -30,7 +30,7 @@ bladePlugin.prototype.loadInventory = function(data) {
|
||||
|
||||
// Create division to hold inventory
|
||||
var invDiv = $('<div></div>');
|
||||
|
||||
|
||||
// Create a fieldset
|
||||
var fieldSet = $('<fieldset></fieldset>');
|
||||
var legend = $('<legend>Hardware</legend>');
|
||||
@ -58,7 +58,7 @@ bladePlugin.prototype.loadInventory = function(data) {
|
||||
|
||||
/**
|
||||
* Load clone page
|
||||
*
|
||||
*
|
||||
* @param node Source node to clone
|
||||
*/
|
||||
bladePlugin.prototype.loadClonePage = function(node) {
|
||||
@ -78,13 +78,13 @@ bladePlugin.prototype.loadClonePage = function(node) {
|
||||
// Add clone tab
|
||||
tab.add(newTabId, 'Clone', cloneForm, true);
|
||||
}
|
||||
|
||||
|
||||
tab.select(newTabId);
|
||||
};
|
||||
|
||||
/**
|
||||
* Load provision page
|
||||
*
|
||||
*
|
||||
* @param tabId The provision tab ID
|
||||
*/
|
||||
bladePlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
@ -142,14 +142,14 @@ bladePlugin.prototype.loadResources = function() {
|
||||
var tabId = 'bladeResourceTab';
|
||||
// Remove loader
|
||||
$('#' + tabId).find('img').remove();
|
||||
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Not yet supported');
|
||||
|
||||
// Create resource form
|
||||
var resrcForm = $('<div class="form"></div>');
|
||||
resrcForm.append(infoBar);
|
||||
|
||||
|
||||
$('#' + tabId).append(resrcForm);
|
||||
};
|
||||
|
||||
@ -160,18 +160,18 @@ bladePlugin.prototype.addNode = function() {
|
||||
var addNodeForm = $('<div id="addBladeCenter" class="form"></div>');
|
||||
var info = createInfoBar('Add a BladeCenter node');
|
||||
addNodeForm.append(info);
|
||||
|
||||
|
||||
var typeFS = $('<fieldset></fieldset>');
|
||||
var typeLegend = $('<legend>Type</legend>');
|
||||
typeFS.append(typeLegend);
|
||||
addNodeForm.append(typeFS);
|
||||
|
||||
|
||||
var settingsFS = $('<fieldset id="bcSettings"></fieldset>');
|
||||
var nodeLegend = $('<legend>Settings</legend>');
|
||||
settingsFS.append(nodeLegend);
|
||||
addNodeForm.append(settingsFS);
|
||||
|
||||
typeFS.append('<div>' +
|
||||
|
||||
typeFS.append('<div>' +
|
||||
'<label>Node type:</label>' +
|
||||
'<select id="typeSelect">' +
|
||||
'<option value="amm">AMM</option>' +
|
||||
@ -179,18 +179,18 @@ bladePlugin.prototype.addNode = function() {
|
||||
'<option value="scan">Blade by scan</option>' +
|
||||
'</select>' +
|
||||
'</div>');
|
||||
|
||||
|
||||
// Change dialog width
|
||||
$('#addBladeCenter').dialog('option', 'width', '400');
|
||||
|
||||
|
||||
typeFS.find('#typeSelect').bind('change', function(){
|
||||
// Remove any existing warnings
|
||||
$('#addBladeCenter .ui-state-error').remove();
|
||||
settingsFS.find('div').remove();
|
||||
|
||||
|
||||
// Change dialog width
|
||||
$('#addBladeCenter').dialog('option', 'width', '400');
|
||||
|
||||
|
||||
var nodeType = $(this).val();
|
||||
switch (nodeType) {
|
||||
case 'amm':
|
||||
@ -208,17 +208,17 @@ bladePlugin.prototype.addNode = function() {
|
||||
break;
|
||||
case 'scan':
|
||||
settingsFS.append('<div><label style="vertical-align: middle;">Blade MPA:</label><select id="bladeMpa"></select></div>');
|
||||
|
||||
|
||||
// Change dialog width
|
||||
$('#addBladeCenter').dialog('option', 'width', '650');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Do not continue if node type is AMM
|
||||
if ($(this).val() == 'amm') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Gather AMM nodes
|
||||
settingsFS.find('select:eq(0)').after(createLoader());
|
||||
$.ajax({
|
||||
@ -234,16 +234,16 @@ bladePlugin.prototype.addNode = function() {
|
||||
var position = 0;
|
||||
var tmp = '';
|
||||
var options = '';
|
||||
|
||||
|
||||
// Remove the loading image
|
||||
settingsFS.find('img').remove();
|
||||
|
||||
|
||||
// Do not continue if no AMM nodes are found
|
||||
if (data.rsp.length < 1) {
|
||||
$('#addBladeCenter').prepend(createWarnBar('Please define an AMM node before continuing'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Create options for AMM nodes
|
||||
for (var i in data.rsp){
|
||||
tmp = data.rsp[i];
|
||||
@ -257,7 +257,7 @@ bladePlugin.prototype.addNode = function() {
|
||||
if (data.msg != 'scan') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Create Scan button
|
||||
var scan = createButton('Scan');
|
||||
scan.bind('click', function(){
|
||||
@ -273,10 +273,10 @@ bladePlugin.prototype.addNode = function() {
|
||||
args : '',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Show scanned results for AMM
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
success: function(data){
|
||||
@ -284,12 +284,12 @@ bladePlugin.prototype.addNode = function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
settingsFS.find('select:eq(0)').after(scan);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Create dialog for BladeCenter
|
||||
addNodeForm.dialog({
|
||||
modal : true,
|
||||
@ -306,7 +306,7 @@ bladePlugin.prototype.addNode = function() {
|
||||
// Remove any existing warnings
|
||||
$('#addBladeCenter .ui-state-error').remove();
|
||||
var addMethod = $('#typeSelect').val();
|
||||
|
||||
|
||||
if (addMethod == "amm") {
|
||||
addAmmNode();
|
||||
} else if(addMethod == "blade") {
|
||||
@ -320,7 +320,7 @@ bladePlugin.prototype.addNode = function() {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
addNodeForm.find('#typeSelect').trigger('change');
|
||||
};
|
||||
|
||||
@ -331,16 +331,16 @@ bladePlugin.prototype.addNode = function() {
|
||||
function addAmmNode(){
|
||||
var args = '';
|
||||
var errorMsg = '';
|
||||
|
||||
|
||||
// Check for missing inputs
|
||||
$('#addBladeCenter input').each(function(){
|
||||
if (!$(this).val()) {
|
||||
errorMsg = 'Please provide a value for each missing field!';
|
||||
}
|
||||
|
||||
|
||||
args += $(this).val() + ',';
|
||||
});
|
||||
|
||||
|
||||
// Do not continue if error was found
|
||||
if (errorMsg) {
|
||||
$('#addBladeCenter').prepend(createWarnBar(errorMsg));
|
||||
@ -348,7 +348,7 @@ function addAmmNode(){
|
||||
}
|
||||
|
||||
args = args.substring(0, args.length - 1);
|
||||
|
||||
|
||||
// Add the loader
|
||||
$('#addBladeCenter').append(createLoader());
|
||||
$('.ui-dialog-buttonpane .ui-button').attr('disabled', true);
|
||||
@ -385,17 +385,17 @@ function addBladeNode(){
|
||||
var series = $('#bcSettings input[name="bladeSeries"]:selected').val();
|
||||
var mpa = $('#bcSettings select[name="bladeMpa"]').val();
|
||||
|
||||
var args = '-t;node;-o;' + name
|
||||
+ ';id=' + id
|
||||
+ ';nodetype=osi;groups=' + group
|
||||
+ ';mgt=blade;mpa=' + mpa
|
||||
var args = '-t;node;-o;' + name
|
||||
+ ';id=' + id
|
||||
+ ';nodetype=osi;groups=' + group
|
||||
+ ';mgt=blade;mpa=' + mpa
|
||||
+ ';serialflow=hard';
|
||||
|
||||
|
||||
// Set the serial speed and port for LS series blade
|
||||
if (series != 'js') {
|
||||
args += ';serialspeed=19200;serialport=1';
|
||||
}
|
||||
|
||||
|
||||
// Check for missing inputs
|
||||
if (!name || !group || !id || !mpa) {
|
||||
$('#addBladeCenter').prepend(createWarnBar("Please provide a value for each missing field!"));
|
||||
@ -427,7 +427,7 @@ function addBladeNode(){
|
||||
|
||||
// Append response message to dialog
|
||||
$('#addBladeCenter').prepend(createInfoBar(rspMessage));
|
||||
|
||||
|
||||
// Change dialog button
|
||||
$('#addBladeCenter').dialog("option", "buttons", {
|
||||
"Close" : function() {
|
||||
@ -440,29 +440,29 @@ function addBladeNode(){
|
||||
|
||||
/**
|
||||
* Show rscan results
|
||||
*
|
||||
*
|
||||
* @param results Results from rscan of blade MPA
|
||||
*/
|
||||
function showScanAmmResult(results){
|
||||
var rSection = $('<div style="height: 300px; overflow: auto;" id="scanResults"></div>');
|
||||
|
||||
|
||||
// Create table to hold results
|
||||
var rTable = $('<table></table>');
|
||||
|
||||
|
||||
// Reset scan results area
|
||||
$('#addBladeCenter #scanResults').remove();
|
||||
$('#bcSettings img').remove();
|
||||
$('#bcSettings button').attr('disabled', '');
|
||||
if (!results)
|
||||
return;
|
||||
|
||||
|
||||
// Do not continue if there are no results
|
||||
var rows = results.split("\n");
|
||||
if (rows.length < 2){
|
||||
$('#bcSettings').prepend(createWarnBar(rows[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Add the table header
|
||||
var fields = rows[0].match(/\S+/g);
|
||||
var column = fields.length;
|
||||
@ -472,23 +472,23 @@ function showScanAmmResult(results){
|
||||
row.append('<td>' + fields[i] + '</td>');
|
||||
}
|
||||
rTable.append(row);
|
||||
|
||||
|
||||
// Add table body
|
||||
var line;
|
||||
for (var i = 1; i < rows.length; i++) {
|
||||
line = rows[i];
|
||||
|
||||
|
||||
if (!line)
|
||||
continue;
|
||||
|
||||
|
||||
var fields = line.match(/\S+/g);
|
||||
if (fields[0] == 'mm')
|
||||
continue;
|
||||
|
||||
|
||||
// Create a row for each result
|
||||
var row = $('<tr></tr>');
|
||||
row.append('<td><input type="checkbox" name="' + fields[1] + '"></td>');
|
||||
|
||||
|
||||
// Add column for each field
|
||||
for (var j = 0; j < column; j++){
|
||||
if (fields[j]) {
|
||||
@ -501,11 +501,11 @@ function showScanAmmResult(results){
|
||||
row.append('<td></td>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Append row to table
|
||||
rTable.append(row);
|
||||
}
|
||||
|
||||
|
||||
rSection.append(rTable);
|
||||
$('#bcSettings').prepend(rSection);
|
||||
}
|
||||
@ -517,25 +517,25 @@ function addMmScanNode(){
|
||||
// Get the AMM name
|
||||
var ammName = $('#bcSettings select').val();
|
||||
var nodeName = '';
|
||||
|
||||
|
||||
$('#bcSettings :checked').each(function() {
|
||||
if ($(this).attr('name')) {
|
||||
nodeName += $(this).attr('name') + ',';
|
||||
nodeName += $(this).parents('tr').find('input').eq(1).val() + ',';
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (!nodeName) {
|
||||
$('#addBladeCenter').prepend(createWarnBar('Please select a node!'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Disabled button
|
||||
$('.ui-dialog-buttonpane button').attr('disabled', 'disabled');
|
||||
|
||||
|
||||
nodeName = nodeName.substr(0, nodeName.length - 1);
|
||||
$('#nodeAttrs').append(createLoader());
|
||||
|
||||
|
||||
// Send add request
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@ -554,7 +554,7 @@ function addMmScanNode(){
|
||||
|
||||
/**
|
||||
* Create provision existing node division
|
||||
*
|
||||
*
|
||||
* @param inst Provision tab instance
|
||||
* @return Provision existing node division
|
||||
*/
|
||||
@ -566,22 +566,22 @@ function createBladeProvisionExisting(inst) {
|
||||
var nodeFS = $('<fieldset></fieldset>');
|
||||
var nodeLegend = $('<legend>Node</legend>');
|
||||
nodeFS.append(nodeLegend);
|
||||
|
||||
|
||||
var nodeAttr = $('<div style="display: inline-table; vertical-align: middle; width: 85%; margin-left: 10px;"></div>');
|
||||
nodeFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
nodeFS.append(nodeAttr);
|
||||
|
||||
|
||||
// Create image fieldset
|
||||
var imgFS = $('<fieldset></fieldset>');
|
||||
var imgLegend = $('<legend>Image</legend>');
|
||||
imgFS.append(imgLegend);
|
||||
|
||||
|
||||
var imgAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imgFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
imgFS.append(imgAttr);
|
||||
|
||||
|
||||
provExisting.append(nodeFS, imgFS);
|
||||
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
var groupLabel = $('<label>Group:</label>');
|
||||
@ -589,7 +589,7 @@ function createBladeProvisionExisting(inst) {
|
||||
|
||||
// Turn on auto complete for group
|
||||
var dTableDivId = 'bladeNodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
// Split group names into an array
|
||||
var tmp = groupNames.split(',');
|
||||
@ -642,13 +642,13 @@ function createBladeProvisionExisting(inst) {
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
imgAttr.append(method);
|
||||
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os"/>');
|
||||
osInput.one('focus', function() {
|
||||
var tmp = $.cookie('osvers');
|
||||
var tmp = $.cookie('xcat_osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -665,7 +665,7 @@ function createBladeProvisionExisting(inst) {
|
||||
var archLabel = $('<label>Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch"/>');
|
||||
archInput.one('focus', function() {
|
||||
var tmp = $.cookie('osarchs');
|
||||
var tmp = $.cookie('xcat_osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -682,7 +682,7 @@ function createBladeProvisionExisting(inst) {
|
||||
var profileLabel = $('<label>Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile"/>');
|
||||
profileInput.one('focus', function() {
|
||||
var tmp = $.cookie('profiles');
|
||||
var tmp = $.cookie('xcat_profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -706,7 +706,7 @@ function createBladeProvisionExisting(inst) {
|
||||
|
||||
// Get provision tab ID
|
||||
var thisTabId = 'bladeProvisionTab' + inst;
|
||||
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'bladeNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
@ -714,7 +714,7 @@ function createBladeProvisionExisting(inst) {
|
||||
errorMessage += 'You need to select a node. ';
|
||||
ready = false;
|
||||
}
|
||||
|
||||
|
||||
// Check booth method
|
||||
var boot = $('#' + thisTabId + ' select[name=bootMethod]');
|
||||
if (!boot.val()) {
|
||||
@ -724,7 +724,7 @@ function createBladeProvisionExisting(inst) {
|
||||
} else {
|
||||
boot.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
|
||||
// Check operating system image
|
||||
var os = $('#' + thisTabId + ' input[name=os]');
|
||||
if (!os.val()) {
|
||||
@ -734,7 +734,7 @@ function createBladeProvisionExisting(inst) {
|
||||
} else {
|
||||
os.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
|
||||
// Check architecture
|
||||
var arch = $('#' + thisTabId + ' input[name=arch]');
|
||||
if (!arch.val()) {
|
||||
@ -744,7 +744,7 @@ function createBladeProvisionExisting(inst) {
|
||||
} else {
|
||||
arch.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
|
||||
// Check profile
|
||||
var profile = $('#' + thisTabId + ' input[name=profile]');
|
||||
if (!profile.val()) {
|
||||
@ -754,12 +754,12 @@ function createBladeProvisionExisting(inst) {
|
||||
} else {
|
||||
profile.css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
|
||||
|
||||
// If all inputs are valid, ready to provision
|
||||
if (ready) {
|
||||
if (ready) {
|
||||
// Disable provision button
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
|
||||
// Prepend status bar
|
||||
var statBar = createStatusBar('bladeProvisionStatBar' + inst);
|
||||
statBar.append(createLoader(''));
|
||||
@ -768,11 +768,11 @@ function createBladeProvisionExisting(inst) {
|
||||
// Disable all inputs
|
||||
var inputs = $('#' + thisTabId + ' input');
|
||||
inputs.attr('disabled', 'disabled');
|
||||
|
||||
|
||||
// Disable all selects
|
||||
var selects = $('#' + thisTabId + ' select');
|
||||
selects.attr('disabled', 'disabled');
|
||||
|
||||
|
||||
/**
|
||||
* (1) Set operating system
|
||||
*/
|
||||
@ -801,7 +801,7 @@ function createBladeProvisionExisting(inst) {
|
||||
|
||||
/**
|
||||
* Update the provision existing node status
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateBladeProvisionExistingStatus(data) {
|
||||
@ -813,11 +813,11 @@ function updateBladeProvisionExistingStatus(data) {
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
// Get provision tab instance
|
||||
var inst = args[1].replace('out=', '');
|
||||
|
||||
|
||||
// Get provision tab and status bar ID
|
||||
var statBarId = 'bladeProvisionStatBar' + inst;
|
||||
var tabId = 'bladeProvisionTab' + inst;
|
||||
|
||||
|
||||
/**
|
||||
* (2) Remote install
|
||||
*/
|
||||
@ -830,11 +830,11 @@ function updateBladeProvisionExistingStatus(data) {
|
||||
var os = $('#' + tabId + ' input[name="os"]').val();
|
||||
var profile = $('#' + tabId + ' input[name="profile"]').val();
|
||||
var arch = $('#' + tabId + ' input[name="arch"]').val();
|
||||
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'bladeNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
|
||||
|
||||
// Begin installation
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -848,19 +848,19 @@ function updateBladeProvisionExistingStatus(data) {
|
||||
|
||||
success : updateBladeProvisionExistingStatus
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* (3) Prepare node for boot
|
||||
*/
|
||||
if (cmd == 'nodeadd') {
|
||||
// Get provision method
|
||||
var bootMethod = $('#' + tabId + ' select[name=bootMethod]').val();
|
||||
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'bladeNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -875,18 +875,18 @@ function updateBladeProvisionExistingStatus(data) {
|
||||
success : updateBladeProvisionExistingStatus
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (4) Power on node
|
||||
*/
|
||||
if (cmd == 'nodeset') {
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
|
||||
// Get nodes that were checked
|
||||
var dTableId = 'bladeNodesDatatable' + inst;
|
||||
var tgts = getNodesChecked(dTableId);
|
||||
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -901,16 +901,16 @@ function updateBladeProvisionExistingStatus(data) {
|
||||
success : updateBladeProvisionExistingStatus
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (5) Done
|
||||
*/
|
||||
else if (cmd == 'rpower') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
$('#' + statBarId).find('img').remove();
|
||||
|
||||
|
||||
// If installation was successful
|
||||
if (prg.html().indexOf('Error') == -1) {
|
||||
$('#' + statBarId).find('div').append('<pre>It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.</pre>');
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Create nodes datatable for a given group
|
||||
*
|
||||
*
|
||||
* @param group Group name
|
||||
* @param outId Division ID to append datatable
|
||||
* @return Nodes datatable
|
||||
@ -19,26 +19,26 @@ function createNodesDatatable(group, outId) {
|
||||
|
||||
/**
|
||||
* Create nodes datatable
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
success : function(data) {
|
||||
// Data returned
|
||||
var rsp = data.rsp;
|
||||
|
||||
|
||||
// Get output ID
|
||||
var outId = data.msg;
|
||||
// Get datatable ID
|
||||
var dTableId = outId.replace('DIV', '');
|
||||
|
||||
|
||||
// Node attributes hash
|
||||
var attrs = new Object();
|
||||
// Node attributes
|
||||
var headers = new Object();
|
||||
|
||||
|
||||
// Clear nodes datatable division
|
||||
$('#' + outId).empty();
|
||||
|
||||
|
||||
// Create nodes datatable
|
||||
var node = null;
|
||||
var args;
|
||||
@ -48,22 +48,22 @@ function createNodesDatatable(group, outId) {
|
||||
if (pos > -1) {
|
||||
var temp = rsp[i].split(': ');
|
||||
node = jQuery.trim(temp[1]);
|
||||
|
||||
|
||||
// Create a hash for the node attributes
|
||||
attrs[node] = new Object();
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
// Get key and value
|
||||
args = rsp[i].split('=');
|
||||
var key = jQuery.trim(args[0]);
|
||||
var val = jQuery.trim(args[1]);
|
||||
|
||||
|
||||
// Create hash table
|
||||
attrs[node][key] = val;
|
||||
headers[key] = 1;
|
||||
}
|
||||
|
||||
|
||||
// Sort headers
|
||||
var sorted = new Array();
|
||||
for ( var key in headers) {
|
||||
@ -73,14 +73,14 @@ function createNodesDatatable(group, outId) {
|
||||
}
|
||||
}
|
||||
sorted.sort();
|
||||
|
||||
|
||||
// Add column for check box and node
|
||||
sorted.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">', 'node');
|
||||
|
||||
|
||||
// Create nodes datatable
|
||||
var dTable = new DataTable(dTableId);
|
||||
dTable.init(sorted);
|
||||
|
||||
|
||||
// Go through each node
|
||||
for ( var node in attrs) {
|
||||
// Create a row
|
||||
@ -88,7 +88,7 @@ function createNodesDatatable(group, outId) {
|
||||
// Create a check box
|
||||
var checkBx = '<input type="checkbox" name="' + node + '"/>';
|
||||
row.push(checkBx, node);
|
||||
|
||||
|
||||
// Go through each header
|
||||
for ( var i = 2; i < sorted.length; i++) {
|
||||
// Add node attributes to the row
|
||||
@ -100,11 +100,11 @@ function createNodesDatatable(group, outId) {
|
||||
row.push('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add row to table
|
||||
dTable.add(row);
|
||||
}
|
||||
|
||||
|
||||
$('#' + outId).append(dTable.object());
|
||||
$('#' + dTableId).dataTable({
|
||||
'iDisplayLength': 50,
|
||||
@ -120,7 +120,7 @@ function createNodesDatatable(group, outId) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Fix table styling
|
||||
$('#' + dTableId + '_wrapper .dataTables_filter label').css('width', '250px');
|
||||
} // End of function(data)
|
||||
@ -129,7 +129,7 @@ function createNodesDatatable(group, outId) {
|
||||
|
||||
/**
|
||||
* Create provision existing node division
|
||||
*
|
||||
*
|
||||
* @param plugin Plugin name to create division for
|
||||
* @param inst Provision tab instance
|
||||
* @return Provision existing node division
|
||||
@ -145,7 +145,7 @@ function createProvisionExisting(plugin, inst) {
|
||||
|
||||
// Turn on auto complete for group
|
||||
var dTableDivId = plugin + 'NodesDatatableDIV' + inst; // Division ID where nodes datatable will be appended
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
// Split group names into an array
|
||||
var tmp = groupNames.split(',');
|
||||
@ -215,7 +215,7 @@ function createProvisionExisting(plugin, inst) {
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os"/>');
|
||||
osInput.one('focus', function() {
|
||||
var tmp = $.cookie('osvers');
|
||||
var tmp = $.cookie('xcat_osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -232,7 +232,7 @@ function createProvisionExisting(plugin, inst) {
|
||||
var archLabel = $('<label>Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch"/>');
|
||||
archInput.one('focus', function() {
|
||||
var tmp = $.cookie('osarchs');
|
||||
var tmp = $.cookie('xcat_osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -249,7 +249,7 @@ function createProvisionExisting(plugin, inst) {
|
||||
var profileLabel = $('<label>Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile"/>');
|
||||
profileInput.one('focus', function() {
|
||||
var tmp = $.cookie('profiles');
|
||||
var tmp = $.cookie('xcat_profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -276,7 +276,7 @@ function createProvisionExisting(plugin, inst) {
|
||||
|
||||
/**
|
||||
* Create provision new node division
|
||||
*
|
||||
*
|
||||
* @param inst Provision tab instance
|
||||
* @return Provision new node division
|
||||
*/
|
||||
@ -293,7 +293,7 @@ function createProvisionNew(plugin, inst) {
|
||||
var groupLabel = $('<label>Group:</label>');
|
||||
var groupInput = $('<input type="text" name="group"/>');
|
||||
groupInput.one('focus', function() {
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -336,7 +336,7 @@ function createProvisionNew(plugin, inst) {
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os"/>');
|
||||
osInput.one('focus', function() {
|
||||
var tmp = $.cookie('osvers');
|
||||
var tmp = $.cookie('xcat_osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -353,7 +353,7 @@ function createProvisionNew(plugin, inst) {
|
||||
var archLabel = $('<label>Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch"/>');
|
||||
archInput.one('focus', function() {
|
||||
var tmp = $.cookie('osarchs');
|
||||
var tmp = $.cookie('xcat_osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -370,7 +370,7 @@ function createProvisionNew(plugin, inst) {
|
||||
var profileLabel = $('<label>Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile"/>');
|
||||
profileInput.one('focus', function() {
|
||||
var tmp = $.cookie('profiles');
|
||||
var tmp = $.cookie('xcat_profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -397,31 +397,31 @@ function createProvisionNew(plugin, inst) {
|
||||
|
||||
/**
|
||||
* Create section to provision node
|
||||
*
|
||||
*
|
||||
* @param plugin Plugin name
|
||||
* @param container Container to hold provision section
|
||||
*/
|
||||
function appendProvisionSection(plugin, container) {
|
||||
// Get provision tab ID
|
||||
var tabId = container.parents('.tab').attr('id');
|
||||
|
||||
if (plugin == 'quick')
|
||||
|
||||
if (plugin == 'quick')
|
||||
appendProvision4Url(container); // For provisioning based on argmunents found in URL
|
||||
else
|
||||
appendProvision4NoUrl(plugin, container);
|
||||
|
||||
|
||||
// Add provision button
|
||||
var provisionBtn = createButton('Provision');
|
||||
provisionBtn.bind('click', function(){
|
||||
provisionNode(tabId);
|
||||
});
|
||||
container.append(provisionBtn);
|
||||
|
||||
|
||||
// Bind image select to change event
|
||||
container.find('select[name=image]').bind('change', function() {
|
||||
createAdvancedOptions($(this).val(), tabId);
|
||||
});
|
||||
|
||||
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -441,15 +441,15 @@ function appendProvisionSection(plugin, container) {
|
||||
$('#' + tabId).prepend(createWarnBar('Please run copycds and genimage in provision page before continuing!'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (i in data.rsp) {
|
||||
imageName = data.rsp[i];
|
||||
position = imageName.indexOf(' ');
|
||||
imageName = imageName.substr(0, position);
|
||||
|
||||
|
||||
$('#' + tabId + ' select[name=image]').append($('<option value="' + imageName + '">' + imageName + '</option>'));
|
||||
}
|
||||
|
||||
|
||||
// Trigger select change event
|
||||
$('#' + tabId + ' select[name=image]').trigger('change');
|
||||
// Show provision button
|
||||
@ -460,102 +460,102 @@ function appendProvisionSection(plugin, container) {
|
||||
|
||||
/**
|
||||
* Create provision node section using URL
|
||||
*
|
||||
*
|
||||
* @param container Container to hold provision section
|
||||
* @returns Nothing
|
||||
*/
|
||||
function appendProvision4Url(container){
|
||||
function appendProvision4Url(container){
|
||||
// Create node fieldset
|
||||
var nodeFS = $('<fieldset></fieldset>');
|
||||
var nodeLegend = $('<legend>Node</legend>');
|
||||
nodeFS.append(nodeLegend);
|
||||
container.append(nodeFS);
|
||||
|
||||
|
||||
var nodeAttr = $('<div style="display: inline-table; vertical-align: middle; width: 85%; margin-left: 10px;"></div>');
|
||||
nodeFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
nodeFS.append(nodeAttr);
|
||||
|
||||
|
||||
// Create image fieldset
|
||||
var imgFS = $('<fieldset></fieldset>');
|
||||
var imgLegend = $('<legend>Image</legend>');
|
||||
imgFS.append(imgLegend);
|
||||
container.append(imgFS);
|
||||
|
||||
|
||||
var imgAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imgFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
imgFS.append(imgAttr);
|
||||
|
||||
|
||||
var query = window.location.search;
|
||||
var args = query.substr(1).split('&');
|
||||
var parms = new Object();
|
||||
var tmp;
|
||||
|
||||
|
||||
// Turn URL arguments into hash array
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
tmp = args[i].split('=');
|
||||
parms[tmp[0]] = tmp[1];
|
||||
}
|
||||
|
||||
|
||||
var master = '';
|
||||
if (parms['master'])
|
||||
master = parms['master'];
|
||||
|
||||
|
||||
var nfsserver = '';
|
||||
if (parms['nfsserver'])
|
||||
nfsserver = parms['nfsserver'];
|
||||
|
||||
|
||||
var tftpserver = '';
|
||||
if (parms['tftpserver'])
|
||||
tftpserver = parms['tftpserver'];
|
||||
|
||||
|
||||
nodeAttr.append('<div><label>Node:</label><input type="text" disabled="disabled" name="node" value="' + parms['nodes'] + '"></div>');
|
||||
|
||||
|
||||
imgAttr.append('<div><label>Architecture:</label><input type="text" disabled="disabled" name="arch" value="' + parms['arch'] + '"></div>');
|
||||
imgAttr.append('<div><label>Image name:</label><select name="image"></select></div>');
|
||||
imgAttr.append( '<div><label>Install NIC:</label><input type="text" name="installNic"/></div>');
|
||||
imgAttr.append('<div><label>Primary NIC:</label><input type="text" name="primaryNic"/></div>');
|
||||
imgAttr.append('<div><label>Primary NIC:</label><input type="text" name="primaryNic"/></div>');
|
||||
imgAttr.append('<div><label>xCAT master:</label><input type="text" name="xcatMaster" value="' + master + '"></div>');
|
||||
imgAttr.append('<div><label>TFTP server:</label><input type="text" name="tftpServer" value="' + tftpserver + '"></div>');
|
||||
imgAttr.append('<div><label>NFS server:</label><input type="text" name="nfsServer" value="' + nfsserver + '"></div>');
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create section to provision node using no URL
|
||||
*
|
||||
*
|
||||
* @param plugin Create provision section for given plugin
|
||||
* @param container Container to hold provision section
|
||||
*/
|
||||
function appendProvision4NoUrl(plugin, container){
|
||||
// Get provision tab ID
|
||||
var tabId = container.parents('.tab').attr('id');
|
||||
|
||||
|
||||
// Create node fieldset
|
||||
var nodeFS = $('<fieldset></fieldset>');
|
||||
var nodeLegend = $('<legend>Node</legend>');
|
||||
nodeFS.append(nodeLegend);
|
||||
container.append(nodeFS);
|
||||
|
||||
|
||||
var nodeAttr = $('<div style="display: inline-table; vertical-align: middle; width: 85%; margin-left: 10px;"></div>');
|
||||
nodeFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
nodeFS.append(nodeAttr);
|
||||
|
||||
|
||||
// Create image fieldset
|
||||
var imgFS = $('<fieldset></fieldset>');
|
||||
var imgLegend = $('<legend>Image</legend>');
|
||||
imgFS.append(imgLegend);
|
||||
container.append(imgFS);
|
||||
|
||||
|
||||
var imgAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imgFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
imgFS.append(imgAttr);
|
||||
|
||||
|
||||
// Select group name
|
||||
var group = $('<div></div>').append('<label>Group:</label>');
|
||||
var groupSelect = $('<select name="group"></select>');
|
||||
group.append(groupSelect);
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
var tmp = groupNames.split(',');
|
||||
groupSelect.append('<option value=""></option>'); // Append empty group name
|
||||
@ -569,14 +569,14 @@ function appendProvision4NoUrl(plugin, container){
|
||||
var nodesTable = $('<div id="nodesTable" style="display: inline-block; max-width: 800px;"><p>Select a group to view its nodes</p></div>');
|
||||
nodes.append(nodesTable);
|
||||
nodeAttr.append(nodes);
|
||||
|
||||
|
||||
// Select architecture
|
||||
var arch = $('<div></div>').append('<label>Architecture:</label>');
|
||||
var archName = $.cookie('osarchs');
|
||||
var arch = $('<div></div>').append('<label>Architecture:</label>');
|
||||
var archName = $.cookie('xcat_osarchs');
|
||||
if (archName) {
|
||||
var archSelect = $('<select name="arch"></select>');
|
||||
arch.append(archSelect);
|
||||
|
||||
|
||||
var tmp = archName.split(',');
|
||||
for (var i in tmp)
|
||||
archSelect.append('<option value="' + tmp[i] + '">' + tmp[i] + '</option>');
|
||||
@ -591,30 +591,30 @@ function appendProvision4NoUrl(plugin, container){
|
||||
imgAttr.append('<div><label>xCAT master:</label><input type="text" name="xcatMaster"/></div>');
|
||||
imgAttr.append('<div><label>TFTP server:</label><input type="text" name="tftpServer"/></div>');
|
||||
imgAttr.append('<div><label>NFS server:</label><input type="text" name=nfsServer"/></div>');
|
||||
|
||||
|
||||
// When a group is selected, show the nodes belonging to that group
|
||||
groupSelect.bind('change', function() {
|
||||
var nodesTableId = '#' + tabId + ' #nodesTable';
|
||||
$(nodesTableId).append(createLoader());
|
||||
createNodesTable($(this).val(), nodesTableId);
|
||||
});
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provision node
|
||||
*
|
||||
*
|
||||
* @param tabId Provision tab ID
|
||||
*/
|
||||
function provisionNode(tabId) {
|
||||
var errorMessage = "";
|
||||
var args = new Array();
|
||||
var node = "";
|
||||
|
||||
|
||||
// Delete any existing warnings
|
||||
$('#' + tabId + ' .ui-state-error').remove();
|
||||
|
||||
|
||||
// Go through each input
|
||||
$('#' + tabId + ' input[type!="checkbox"]').each(function() {
|
||||
if (!$(this).val()) {
|
||||
@ -624,13 +624,13 @@ function provisionNode(tabId) {
|
||||
args.push($(this).val());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Do not continue if error was found
|
||||
if (errorMessage) {
|
||||
$('#' + tabId).prepend(createWarnBar(errorMessage));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If jumped from nodes page, get node name
|
||||
if (tabId == 'quick') {
|
||||
node = args.shift();
|
||||
@ -639,25 +639,25 @@ function provisionNode(tabId) {
|
||||
args.unshift($('#' + tabId + ' input[name=arch]').val());
|
||||
node = getCheckedByObj($('#' + tabId + ' #nodesTable'));
|
||||
}
|
||||
|
||||
|
||||
// Do not continue if a node is not given
|
||||
if (!node) {
|
||||
$('#' + tabId).prepend(createWarnBar('Please select a node!'));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var software = getCheckedByObj($('#' + tabId + ' #advanced'));
|
||||
var imageName = $('#' + tabId + ' select[name=image]').val();
|
||||
var provision = args.join(',');
|
||||
|
||||
var url = 'lib/cmd.php?cmd=webrun&tgt=&args=provision;' +
|
||||
|
||||
var url = 'lib/cmd.php?cmd=webrun&tgt=&args=provision;' +
|
||||
node + ';' + imageName + ';' + provision + ';' + software + '&msg=&opts=flush';
|
||||
$('#' + tabId).prepend(createIFrame(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create advance option
|
||||
*
|
||||
*
|
||||
* @param image Image name
|
||||
* @param outId Output area ID
|
||||
*/
|
||||
@ -678,29 +678,29 @@ function createAdvancedOptions(image, outId) {
|
||||
var provMethod = '';
|
||||
var tmpStr = '';
|
||||
var position = 0;
|
||||
|
||||
|
||||
for (var i = 0; i < data.rsp.length; i++) {
|
||||
tmpStr = data.rsp[i];
|
||||
if (tmpStr.indexOf('osname') != -1) {
|
||||
position = tmpStr.indexOf('=');
|
||||
osName = tmpStr.substr(position + 1);
|
||||
}
|
||||
|
||||
|
||||
if (tmpStr.indexOf('provmethod') != -1) {
|
||||
position = tmpStr.indexOf('=');
|
||||
provMethod = tmpStr.substr(position + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#' + outId + ' #advanced').remove();
|
||||
if (osName.toLowerCase() == 'aix')
|
||||
return;
|
||||
|
||||
|
||||
if (provMethod == 'install') {
|
||||
// Create advanced fieldset
|
||||
var advancedFS = $('<fieldset id="advanced"></fieldset>').append($('<legend>Advanced</legend>'));
|
||||
$('#' + outId + ' div.form fieldset:eq(1)').after(advancedFS);
|
||||
|
||||
|
||||
advancedFS.append('<div><input type="checkbox" checked="checked" name="ganglia">Install Ganglia monitoring</div>');
|
||||
}
|
||||
}
|
||||
@ -709,11 +709,11 @@ function createAdvancedOptions(image, outId) {
|
||||
|
||||
/**
|
||||
* Create nodes table
|
||||
*
|
||||
*
|
||||
* @param group Group name
|
||||
* @param outId Output section ID
|
||||
*/
|
||||
function createNodesTable(group, outId) {
|
||||
function createNodesTable(group, outId) {
|
||||
// Get group nodes
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@ -728,26 +728,26 @@ function createNodesTable(group, outId) {
|
||||
success : function(data) {
|
||||
var outId = $(data.msg);
|
||||
var nodes = data.rsp;
|
||||
|
||||
|
||||
// Create table to hold nodes
|
||||
var nTable = $('<table></table>');
|
||||
var tHead = $('<thead class="ui-widget-header"> <th><input type="checkbox" onclick="selectAll4Table(event, $(this))"></th> <th>Node</th> </thead>');
|
||||
nTable.append(tHead);
|
||||
var tBody = $('<tbody></tbody>');
|
||||
nTable.append(tBody);
|
||||
|
||||
|
||||
for (var i in nodes) {
|
||||
var node = nodes[i][0];
|
||||
|
||||
|
||||
// Go to next node if there is nothing here
|
||||
if (!node)
|
||||
continue;
|
||||
// Insert node into table
|
||||
tBody.append('<tr><td><input type="checkbox" name="' + node + '"/></td><td>' + node + '</td></tr>');
|
||||
}
|
||||
|
||||
|
||||
outId.empty().append(nTable);
|
||||
|
||||
|
||||
if (nodes.length > 10)
|
||||
outId.css('height', '300px');
|
||||
else
|
||||
@ -758,13 +758,13 @@ function createNodesTable(group, outId) {
|
||||
|
||||
/**
|
||||
* Get select element names
|
||||
*
|
||||
*
|
||||
* @param obj Object to get selected element names
|
||||
* @return Nodes name seperate by a comma
|
||||
*/
|
||||
function getCheckedByObj(obj) {
|
||||
var str = '';
|
||||
|
||||
|
||||
// Get nodes that were checked
|
||||
obj.find('input:checked').each(function() {
|
||||
if ($(this).attr('name')) {
|
||||
@ -781,7 +781,7 @@ function getCheckedByObj(obj) {
|
||||
|
||||
/**
|
||||
* Select all checkboxes in the table
|
||||
*
|
||||
*
|
||||
* @param event Event on element
|
||||
* @param obj Object triggering event
|
||||
*/
|
||||
|
@ -7,7 +7,7 @@ $(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
var esxPlugin = function() {
|
||||
@ -17,9 +17,9 @@ var esxPlugin = function() {
|
||||
/**
|
||||
* Configure self-service page
|
||||
*/
|
||||
esxPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
esxPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
var configAccordion = $('<div id="esxConfigAccordion"></div>');
|
||||
|
||||
|
||||
// Create accordion panel for profiles
|
||||
var profileSection = $('<div id="esxConfigProfile"></div>');
|
||||
var profileLnk = $('<h3><a href="#">Profiles</a></h3>').click(function () {
|
||||
@ -34,11 +34,11 @@ esxPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
|
||||
// Add info bar
|
||||
$('#esxConfigProfile').append(createInfoBar('Not yet supported'));
|
||||
|
||||
|
||||
// Resize accordion
|
||||
configAccordion.accordion('resize');
|
||||
});
|
||||
|
||||
|
||||
// Create accordion panel for images
|
||||
var imgSection = $('<div id="esxConfigImages"></div>');
|
||||
var imgLnk = $('<h3><a href="#">Images</a></h3>').click(function () {
|
||||
@ -50,7 +50,7 @@ esxPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
|
||||
queryImages('esxConfigImages');
|
||||
});
|
||||
|
||||
|
||||
// Create accordion panel for groups
|
||||
var groupsSection = $('<div id="esxConfigGroups"></div>');
|
||||
var groupsLnk = $('<h3><a href="#">Groups</a></h3>').click(function () {
|
||||
@ -62,17 +62,17 @@ esxPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
|
||||
queryGroups('esxConfigGroups');
|
||||
});
|
||||
|
||||
|
||||
configAccordion.append(profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection);
|
||||
$('#' + tabId).append(configAccordion);
|
||||
configAccordion.accordion();
|
||||
|
||||
|
||||
profileLnk.trigger('click');
|
||||
};
|
||||
|
||||
/**
|
||||
* Migrate node
|
||||
*
|
||||
*
|
||||
* @param node Node to migrate
|
||||
*/
|
||||
esxPlugin.prototype.loadMigratePage = function(node) {
|
||||
@ -81,7 +81,7 @@ esxPlugin.prototype.loadMigratePage = function(node) {
|
||||
|
||||
/**
|
||||
* Clone node (service page)
|
||||
*
|
||||
*
|
||||
* @param node Node to clone
|
||||
*/
|
||||
esxPlugin.prototype.serviceClone = function(node) {
|
||||
@ -90,7 +90,7 @@ esxPlugin.prototype.serviceClone = function(node) {
|
||||
|
||||
/**
|
||||
* Load provision page (service page)
|
||||
*
|
||||
*
|
||||
* @param tabId
|
||||
* Tab ID where page will reside
|
||||
* @return Nothing
|
||||
@ -101,23 +101,23 @@ esxPlugin.prototype.loadServiceProvisionPage = function(tabId) {
|
||||
|
||||
/**
|
||||
* Show node inventory (service page)
|
||||
*
|
||||
*
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
esxPlugin.prototype.loadServiceInventory = function(data) {
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Load node inventory
|
||||
*
|
||||
*
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
esxPlugin.prototype.loadInventory = function(data) {
|
||||
var args = data.msg.split(',');
|
||||
var tabId = args[0].replace('out=', '');
|
||||
var node = args[1].replace('node=', '');
|
||||
|
||||
|
||||
// Get node inventory
|
||||
var inv = data.rsp;
|
||||
|
||||
@ -127,12 +127,12 @@ esxPlugin.prototype.loadInventory = function(data) {
|
||||
// Create division to hold inventory
|
||||
var invDivId = tabId + 'Inventory';
|
||||
var invDiv = $('<div></div>');
|
||||
|
||||
|
||||
// Create a fieldset
|
||||
var fieldSet = $('<fieldset></fieldset>');
|
||||
var legend = $('<legend>Hardware</legend>');
|
||||
fieldSet.append(legend);
|
||||
|
||||
|
||||
var oList = $('<ol></ol>');
|
||||
fieldSet.append(oList);
|
||||
invDiv.append(fieldSet);
|
||||
@ -156,7 +156,7 @@ esxPlugin.prototype.loadInventory = function(data) {
|
||||
|
||||
/**
|
||||
* Load clone page
|
||||
*
|
||||
*
|
||||
* @param node Source node to clone
|
||||
*/
|
||||
esxPlugin.prototype.loadClonePage = function(node) {
|
||||
@ -176,13 +176,13 @@ esxPlugin.prototype.loadClonePage = function(node) {
|
||||
// Add clone tab
|
||||
tab.add(newTabId, 'Clone', cloneForm, true);
|
||||
}
|
||||
|
||||
|
||||
tab.select(newTabId);
|
||||
};
|
||||
|
||||
/**
|
||||
* Load provision page
|
||||
*
|
||||
*
|
||||
* @param tabId The provision tab ID
|
||||
*/
|
||||
esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
@ -223,36 +223,36 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
|
||||
// Append to provision tab
|
||||
$('#' + tabId).append(provForm);
|
||||
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
|
||||
// Create hardware fieldset
|
||||
var hwFS = $('<fieldset></fieldset>');
|
||||
var hwLegend = $('<legend>Hardware</legend>');
|
||||
hwFS.append(hwLegend);
|
||||
|
||||
|
||||
var hwAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
hwFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/hardware.png"></img></div>'));
|
||||
hwFS.append(hwAttr);
|
||||
|
||||
|
||||
// Create image fieldset
|
||||
var imgFS = $('<fieldset></fieldset>');
|
||||
var imgLegend = $('<legend>Image</legend>');
|
||||
imgFS.append(imgLegend);
|
||||
|
||||
|
||||
var imgAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imgFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
imgFS.append(imgAttr);
|
||||
|
||||
|
||||
provForm.append(vmFS, hwFS, imgFS);
|
||||
|
||||
|
||||
// Create hypervisor input
|
||||
var host = $('<div></div>');
|
||||
var hostLabel = $('<label>Host:</label>');
|
||||
@ -260,14 +260,14 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var hostInput = $('<input type="text" name="host"/>');
|
||||
host.append(hostInput);
|
||||
vmAttr.append(host);
|
||||
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
var groupLabel = $('<label>Group:</label>');
|
||||
group.append(groupLabel);
|
||||
|
||||
// Turn on auto complete for group
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
// Split group names into an array
|
||||
var tmp = groupNames.split(',');
|
||||
@ -303,7 +303,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
memory.append(memoryLabel);
|
||||
memory.append(memoryInput);
|
||||
hwAttr.append(memory);
|
||||
|
||||
|
||||
// Create processor dropdown
|
||||
var cpu = $('<div></div>');
|
||||
var cpuLabel = $('<label>Processor:</label>');
|
||||
@ -320,7 +320,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
cpu.append(cpuLabel);
|
||||
cpu.append(cpuSelect);
|
||||
hwAttr.append(cpu);
|
||||
|
||||
|
||||
// Create NIC dropdown
|
||||
var nic = $('<div></div>');
|
||||
var nicLabel = $('<label>NIC:</label>');
|
||||
@ -328,7 +328,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
nic.append(nicLabel);
|
||||
nic.append(nicInput);
|
||||
hwAttr.append(nic);
|
||||
|
||||
|
||||
// Create disk input
|
||||
var disk = $('<div></div>');
|
||||
var diskLabel = $('<label>Disk size:</label>');
|
||||
@ -339,7 +339,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
);
|
||||
disk.append(diskLabel, diskInput, diskSizeSelect);
|
||||
hwAttr.append(disk);
|
||||
|
||||
|
||||
// Create disk storage input
|
||||
var storage = $('<div></div>');
|
||||
var storageLabel = $('<label>Storage:</label>');
|
||||
@ -347,13 +347,13 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
storage.append(storageLabel);
|
||||
storage.append(storageInput);
|
||||
hwAttr.append(storage);
|
||||
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os"/>');
|
||||
osInput.one('focus', function() {
|
||||
var tmp = $.cookie('osvers');
|
||||
var tmp = $.cookie('xcat_osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -364,13 +364,13 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
imgAttr.append(os);
|
||||
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
var archLabel = $('<label>Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch"/>');
|
||||
archInput.one('focus', function() {
|
||||
var tmp = $.cookie('osarchs');
|
||||
var tmp = $.cookie('xcat_osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -381,13 +381,13 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
imgAttr.append(arch);
|
||||
|
||||
|
||||
// Create profile input
|
||||
var profile = $('<div></div>');
|
||||
var profileLabel = $('<label>Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile"/>');
|
||||
profileInput.one('focus', function() {
|
||||
var tmp = $.cookie('profiles');
|
||||
var tmp = $.cookie('xcat_profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -398,7 +398,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
imgAttr.append(profile);
|
||||
|
||||
|
||||
// Create boot method dropdown
|
||||
var method = $('<div></div>');
|
||||
var methodLabel = $('<label>Boot method:</label>');
|
||||
@ -422,10 +422,10 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
var ready = true;
|
||||
|
||||
|
||||
// Get tab ID
|
||||
var tabId = $(this).parents('.ui-tabs-panel').attr('id');
|
||||
|
||||
|
||||
// Check if fields are properly filled in
|
||||
var inputs = $('#' + tabId + ' input:visible');
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
@ -436,7 +436,7 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var selects = $('#' + tabId + ' select:visible');
|
||||
for ( var i = 0; i < selects.length; i++) {
|
||||
if (!selects.eq(i).val()) {
|
||||
@ -446,30 +446,30 @@ esxPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
selects.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ready) {
|
||||
var inst = tabId.replace('kvmProvisionTab', '');
|
||||
|
||||
|
||||
// Prepend status bar
|
||||
var statBar = createStatusBar('kvmProvisionStatBar' + inst);
|
||||
statBar.append(createLoader(''));
|
||||
statBar.prependTo($('#' + tabId));
|
||||
|
||||
|
||||
var host = $('#' + tabId + ' input[name=host]').val();
|
||||
var group = $('#' + tabId + ' select[name=group]').val();
|
||||
var node = $('#' + tabId + ' input[name=node]').val();
|
||||
|
||||
|
||||
var memory = $('#' + tabId + ' input[name=memory]').val();
|
||||
var cpu = $('#' + tabId + ' select[name=cpu]').val();
|
||||
var nic = $('#' + tabId + ' input[name=nic]').val();
|
||||
var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
|
||||
var storage = $('#' + tabId + ' input[name=storage]').val();
|
||||
|
||||
|
||||
var os = $('#' + tabId + ' input[name=os]').val();
|
||||
var arch = $('#' + tabId + ' input[name=arch]').val();
|
||||
var profile = $('#' + tabId + ' input[name=profile]').val();
|
||||
var boot = $('#' + tabId + ' select[name=bootMethod]').val();
|
||||
|
||||
|
||||
/**
|
||||
* (1) Define node
|
||||
*/
|
||||
@ -517,14 +517,14 @@ esxPlugin.prototype.loadResources = function() {
|
||||
var tabId = 'esxResourceTab';
|
||||
// Remove loader
|
||||
$('#' + tabId).find('img').remove();
|
||||
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Not yet supported');
|
||||
|
||||
// Create resource form
|
||||
var resrcForm = $('<div class="form"></div>');
|
||||
resrcForm.append(infoBar);
|
||||
|
||||
|
||||
$('#' + tabId).append(resrcForm);
|
||||
};
|
||||
|
||||
@ -535,13 +535,13 @@ esxPlugin.prototype.addNode = function() {
|
||||
var dialog = $('<div id="addEsx" class="form"></div>');
|
||||
var info = createInfoBar('Add a ESX node');
|
||||
dialog.append(info);
|
||||
|
||||
|
||||
// Create node inputs
|
||||
dialog.append($('<div><label>Node:</label><input name="node" type="text"></div>'));
|
||||
dialog.append($('<div><label>VM host:</label><input name="vmhost" type="text"></div>'));
|
||||
dialog.append($('<div><label>IP address:</label><input name="ip" type="text"></div>'));
|
||||
dialog.append($('<div><label>Groups:</label><input name="groups" type="text"></div>'));
|
||||
|
||||
|
||||
dialog.dialog({
|
||||
title: 'Add node',
|
||||
modal: true,
|
||||
@ -560,13 +560,13 @@ esxPlugin.prototype.addNode = function() {
|
||||
function addEsxNode(){
|
||||
var attr, args;
|
||||
var errorMessage = '';
|
||||
|
||||
|
||||
// Remove existing warnings
|
||||
$('#addEsx .ui-state-error').remove();
|
||||
|
||||
|
||||
// Return input border colors to normal
|
||||
$('#addEsx input').css('border', 'solid #BDBDBD 1px');
|
||||
|
||||
|
||||
// Check node attributes
|
||||
$('#addEsx input').each(function(){
|
||||
attr = $(this).val();
|
||||
@ -575,28 +575,28 @@ function addEsxNode(){
|
||||
$(this).css('border', 'solid #FF0000 1px');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Show error message (if any)
|
||||
if (errorMessage) {
|
||||
$('#addEsx').prepend(createWarnBar(errorMessage));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Create loader
|
||||
$('#addEsx').append(createLoader());
|
||||
|
||||
|
||||
// Change dialog buttons
|
||||
$('#addEsx').dialog('option', 'buttons', {
|
||||
'Close':function() {
|
||||
$('#addEsx').dialog('destroy').remove();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Generate chdef arguments
|
||||
args = '-t;node;-o;' + $('#addEsx input[name="node"]').val()
|
||||
+ ';ip=' + $('#addEsx input[name="ip"]').val()
|
||||
+ ';groups=' + $('#addEsx input[name="groups"]').val()
|
||||
+ ';vmhost=' + $('#addEsx input[name="vmhost"]').val()
|
||||
+ ';groups=' + $('#addEsx input[name="groups"]').val()
|
||||
+ ';vmhost=' + $('#addEsx input[name="vmhost"]').val()
|
||||
+ ';mgt=esx;netboot=xnba;nodetype=osi;profile=compute';
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@ -619,16 +619,16 @@ function addEsxNode(){
|
||||
msg : ''
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Remove loader
|
||||
$('#addEsx img').remove();
|
||||
|
||||
|
||||
// Get return message
|
||||
var message = '';
|
||||
for (var i in data.rsp) {
|
||||
message += data.rsp[i] + '<br/>';
|
||||
}
|
||||
|
||||
|
||||
// Show return message
|
||||
if (message)
|
||||
$('#addEsx').prepend(createInfoBar(message));
|
||||
@ -638,7 +638,7 @@ function addEsxNode(){
|
||||
|
||||
/**
|
||||
* Update the provision node status
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateESXProvisionStatus(data) {
|
||||
@ -650,24 +650,24 @@ function updateESXProvisionStatus(data) {
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
// Get provision tab instance
|
||||
var inst = args[1].replace('out=', '');
|
||||
|
||||
|
||||
// Get provision tab and status bar ID
|
||||
var statBarId = 'kvmProvisionStatBar' + inst;
|
||||
var tabId = 'kvmProvisionTab' + inst;
|
||||
|
||||
|
||||
var node = $('#' + tabId + ' input[name=node]').val();
|
||||
|
||||
|
||||
/**
|
||||
* (2) Create virtual machine
|
||||
*/
|
||||
if (cmd == 'chdef') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Get parameters
|
||||
var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
|
||||
|
||||
|
||||
// Begin installation
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -681,19 +681,19 @@ function updateESXProvisionStatus(data) {
|
||||
|
||||
success : updateESXProvisionStatus
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* (3) Prepare node for boot
|
||||
*/
|
||||
if (cmd == 'mkvm') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
|
||||
// Get provision method
|
||||
var boot = $('#' + tabId + ' select[name=bootMethod]').val();
|
||||
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -708,14 +708,14 @@ function updateESXProvisionStatus(data) {
|
||||
success : updateESXProvisionStatus
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (4) Power on node
|
||||
*/
|
||||
if (cmd == 'nodeset') {
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -730,16 +730,16 @@ function updateESXProvisionStatus(data) {
|
||||
success : updateESXProvisionStatus
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (5) Done
|
||||
*/
|
||||
else if (cmd == 'rpower') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
$('#' + statBarId).find('img').remove();
|
||||
|
||||
|
||||
// If installation was successful
|
||||
if (prg.html().indexOf('Error') == -1) {
|
||||
$('#' + statBarId).find('div').append('<pre>It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.</pre>');
|
||||
|
@ -14,7 +14,7 @@ var ipmiPlugin = function() {
|
||||
|
||||
/**
|
||||
* Steps for hardware discovery wizard
|
||||
*
|
||||
*
|
||||
* @return Discovery steps
|
||||
*/
|
||||
ipmiPlugin.prototype.getStep = function() {
|
||||
@ -37,7 +37,7 @@ ipmiPlugin.prototype.getNextFunction = function() {
|
||||
|
||||
/**
|
||||
* Load node inventory
|
||||
*
|
||||
*
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
ipmiPlugin.prototype.loadInventory = function(data) {
|
||||
@ -82,7 +82,7 @@ ipmiPlugin.prototype.loadInventory = function(data) {
|
||||
|
||||
/**
|
||||
* Load clone page
|
||||
*
|
||||
*
|
||||
* @param node Source node to clone
|
||||
*/
|
||||
ipmiPlugin.prototype.loadClonePage = function(node) {
|
||||
@ -108,7 +108,7 @@ ipmiPlugin.prototype.loadClonePage = function(node) {
|
||||
|
||||
/**
|
||||
* Load provision page
|
||||
*
|
||||
*
|
||||
* @param tabId The provision tab ID
|
||||
*/
|
||||
ipmiPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
@ -297,7 +297,7 @@ function addIdataplex() {
|
||||
|
||||
/**
|
||||
* Create provision existing node division
|
||||
*
|
||||
*
|
||||
* @param inst Provision tab instance
|
||||
* @return Provision existing node division
|
||||
*/
|
||||
@ -336,7 +336,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
var dTableDivId = 'ipmiNodesDatatableDIV' + inst; // Division ID where
|
||||
// nodes datatable will
|
||||
// be appended
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
// Split group names into an array
|
||||
var tmp = groupNames.split(',');
|
||||
@ -397,7 +397,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os"/>');
|
||||
osInput.one('focus', function() {
|
||||
var tmp = $.cookie('osvers');
|
||||
var tmp = $.cookie('xcat_osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -414,7 +414,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
var archLabel = $('<label>Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch"/>');
|
||||
archInput.one('focus', function() {
|
||||
var tmp = $.cookie('osarchs');
|
||||
var tmp = $.cookie('xcat_osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -431,7 +431,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
var profileLabel = $('<label>Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile"/>');
|
||||
profileInput.one('focus', function() {
|
||||
var tmp = $.cookie('profiles');
|
||||
var tmp = $.cookie('xcat_profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -553,7 +553,7 @@ function createIpmiProvisionExisting(inst) {
|
||||
|
||||
/**
|
||||
* Update the provision existing node status
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateIpmiProvisionExistingStatus(data) {
|
||||
@ -645,17 +645,17 @@ function idataplexInitBasic() {
|
||||
}
|
||||
showString += '<td>Start IP:</td><td><input type="text" title="Format: XXX.XXX.XXX.1, last number must be 1.<br/> 172.30.20.1 is suggested." '
|
||||
+ 'name="idataplexnodeip" value="' + tempip + '"></td></tr>';
|
||||
|
||||
|
||||
showString += '<tr><td>Nodes number <br/>per Frame:</td><td><input type="text" title="84: Each frame contains 84 nodes.<br/>Valide Number:20,21,40,41,42,84." '
|
||||
+ 'name="idataplexperframe" value="'
|
||||
+ getDiscoverEnv('idataplexperframe')
|
||||
+ '"></td><td></td><td></td></tr>';
|
||||
|
||||
|
||||
showString += '<tr><td><h3>BMCs:</h3></td></tr>';
|
||||
showString += '<tr><td>Name Range:</td><td><input type="text" title="bmc[1-167] or bmc1-bmc167" '
|
||||
+ 'name="idataplexbmcname" value="'
|
||||
+ getDiscoverEnv('idataplexbmcname') + '"></td>';
|
||||
|
||||
|
||||
if (getDiscoverEnv('idataplexbmcip')) {
|
||||
tempip = getDiscoverEnv('idataplexbmcip');
|
||||
} else {
|
||||
@ -663,12 +663,12 @@ function idataplexInitBasic() {
|
||||
}
|
||||
showString += '<td>Start IP:</td><td><input type="text" title="Format: XXX.XXX.XXX.1, last number must be 1.<br/>172.30.120.1 is suggested." '
|
||||
+ 'name="idataplexbmcip" value="' + tempip + '"></td></tr>';
|
||||
|
||||
|
||||
showString += '<tr><td><h3>Switches:</h3></td></tr>';
|
||||
showString += '<tr><td>Name Range:</td><td><input type="text" title="switch[1-4] or switch1-switch4" '
|
||||
+ 'name="idataplexswitchname" value="'
|
||||
+ getDiscoverEnv('idataplexswitchname') + '"></td>';
|
||||
|
||||
|
||||
if (getDiscoverEnv('idataplexswitchip')) {
|
||||
tempip = getDiscoverEnv('idataplexswitchip');
|
||||
} else {
|
||||
@ -676,7 +676,7 @@ function idataplexInitBasic() {
|
||||
}
|
||||
showString += '<td>Start IP:</td><td><input type="text" title="Format: XXX.XXX.XXX.1, last number must be 1.<br/>172.30.10.1 is suggested." '
|
||||
+ 'name="idataplexswitchip" value="' + tempip + '"></td></tr>';
|
||||
|
||||
|
||||
showString += '<tr><td>Nodes number <br/>per Switch:</td><td><input type="text" title="42: Each switch connect 42 nodes.<br/>Valide Number:20,21,40,41,42."'
|
||||
+ 'name="idataplexperswitch" value="'
|
||||
+ getDiscoverEnv('idataplexperswitch')
|
||||
@ -697,8 +697,8 @@ function idataplexInitBasic() {
|
||||
|
||||
/**
|
||||
* Step 2: Collect and check the basic pattern input
|
||||
*
|
||||
* @param operType Operating type
|
||||
*
|
||||
* @param operType Operating type
|
||||
* @return True if the inputs are correct, false otherwise
|
||||
*/
|
||||
function idataplexCheckBasic(operType) {
|
||||
@ -819,7 +819,7 @@ function idataplexInitNetwork() {
|
||||
+ steps[currentStep] + '</h2>');
|
||||
var infoBar = createInfoBar('Make sure the discovery NIC\'s IP, start IP addresses and DHCP dynamic IP range are in the same subnet.');
|
||||
showDiv.append(infoBar);
|
||||
|
||||
|
||||
// Init the IP range by input
|
||||
if (getDiscoverEnv('idataplexIpStart')) {
|
||||
startIp = getDiscoverEnv('idataplexIpStart');
|
||||
@ -927,7 +927,7 @@ function idataplexCreateSetupFile() {
|
||||
fileContent += "xcat-service-lan:\n" + " dhcp-dynamic-range = "
|
||||
+ getDiscoverEnv('idataplexIpStart') + "-"
|
||||
+ getDiscoverEnv('idataplexIpEnd') + "\n";
|
||||
|
||||
|
||||
fileContent += "xcat-switches:\n" + " hostname-range = "
|
||||
+ getDiscoverEnv('idataplexswitchname') + "\n" + " starting-ip = "
|
||||
+ getDiscoverEnv('idataplexswitchip') + "\n";
|
||||
|
@ -15,9 +15,9 @@ var kvmPlugin = function() {
|
||||
/**
|
||||
* Configure self-service page
|
||||
*/
|
||||
kvmPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
kvmPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
var configAccordion = $('<div id="kvmConfigAccordion"></div>');
|
||||
|
||||
|
||||
// Create accordion panel for profiles
|
||||
var profileSection = $('<div id="kvmConfigProfile"></div>');
|
||||
var profileLnk = $('<h3><a href="#">Profiles</a></h3>').click(function () {
|
||||
@ -32,11 +32,11 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
|
||||
// Add info bar
|
||||
$('#kvmConfigProfile').append(createInfoBar('Not yet supported'));
|
||||
|
||||
|
||||
// Resize accordion
|
||||
configAccordion.accordion('resize');
|
||||
});
|
||||
|
||||
|
||||
// Create accordion panel for images
|
||||
var imgSection = $('<div id="kvmConfigImages"></div>');
|
||||
var imgLnk = $('<h3><a href="#">Images</a></h3>').click(function () {
|
||||
@ -48,7 +48,7 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
|
||||
queryImages('kvmConfigImages');
|
||||
});
|
||||
|
||||
|
||||
// Create accordion panel for groups
|
||||
var groupsSection = $('<div id="kvmConfigGroups"></div>');
|
||||
var groupsLnk = $('<h3><a href="#">Groups</a></h3>').click(function () {
|
||||
@ -60,17 +60,17 @@ kvmPlugin.prototype.loadConfigPage = function(tabId) {
|
||||
|
||||
queryGroups('kvmConfigGroups');
|
||||
});
|
||||
|
||||
|
||||
configAccordion.append(profileLnk, profileSection, imgLnk, imgSection, groupsLnk, groupsSection);
|
||||
$('#' + tabId).append(configAccordion);
|
||||
configAccordion.accordion();
|
||||
|
||||
|
||||
profileLnk.trigger('click');
|
||||
};
|
||||
|
||||
/**
|
||||
* Migrate node
|
||||
*
|
||||
*
|
||||
* @param node Node to migrate
|
||||
*/
|
||||
kvmPlugin.prototype.loadMigratePage = function(node) {
|
||||
@ -79,7 +79,7 @@ kvmPlugin.prototype.loadMigratePage = function(node) {
|
||||
|
||||
/**
|
||||
* Clone node (service page)
|
||||
*
|
||||
*
|
||||
* @param node Node to clone
|
||||
*/
|
||||
kvmPlugin.prototype.serviceClone = function(node) {
|
||||
@ -88,7 +88,7 @@ kvmPlugin.prototype.serviceClone = function(node) {
|
||||
|
||||
/**
|
||||
* Load provision page (service page)
|
||||
*
|
||||
*
|
||||
* @param tabId Tab ID where page will reside
|
||||
*/
|
||||
kvmPlugin.prototype.loadServiceProvisionPage = function(tabId) {
|
||||
@ -97,23 +97,23 @@ kvmPlugin.prototype.loadServiceProvisionPage = function(tabId) {
|
||||
|
||||
/**
|
||||
* Show node inventory (service page)
|
||||
*
|
||||
*
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
kvmPlugin.prototype.loadServiceInventory = function(data) {
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Load node inventory
|
||||
*
|
||||
*
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
kvmPlugin.prototype.loadInventory = function(data) {
|
||||
var args = data.msg.split(',');
|
||||
var tabId = args[0].replace('out=', '');
|
||||
var node = args[1].replace('node=', '');
|
||||
|
||||
|
||||
// Get node inventory
|
||||
var inv = data.rsp;
|
||||
|
||||
@ -122,12 +122,12 @@ kvmPlugin.prototype.loadInventory = function(data) {
|
||||
|
||||
// Create division to hold inventory
|
||||
var invDiv = $('<div></div>');
|
||||
|
||||
|
||||
// Create a fieldset
|
||||
var fieldSet = $('<fieldset></fieldset>');
|
||||
var legend = $('<legend>Hardware</legend>');
|
||||
fieldSet.append(legend);
|
||||
|
||||
|
||||
var oList = $('<ol></ol>');
|
||||
fieldSet.append(oList);
|
||||
invDiv.append(fieldSet);
|
||||
@ -151,7 +151,7 @@ kvmPlugin.prototype.loadInventory = function(data) {
|
||||
|
||||
/**
|
||||
* Load clone page
|
||||
*
|
||||
*
|
||||
* @param node Source node to clone
|
||||
*/
|
||||
kvmPlugin.prototype.loadClonePage = function(node) {
|
||||
@ -171,13 +171,13 @@ kvmPlugin.prototype.loadClonePage = function(node) {
|
||||
// Add clone tab
|
||||
tab.add(newTabId, 'Clone', cloneForm, true);
|
||||
}
|
||||
|
||||
|
||||
tab.select(newTabId);
|
||||
};
|
||||
|
||||
/**
|
||||
* Load provision page
|
||||
*
|
||||
*
|
||||
* @param tabId The provision tab ID
|
||||
*/
|
||||
kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
@ -218,36 +218,36 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
|
||||
// Append to provision tab
|
||||
$('#' + tabId).append(provForm);
|
||||
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
|
||||
// Create hardware fieldset
|
||||
var hwFS = $('<fieldset></fieldset>');
|
||||
var hwLegend = $('<legend>Hardware</legend>');
|
||||
hwFS.append(hwLegend);
|
||||
|
||||
|
||||
var hwAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
hwFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/hardware.png"></img></div>'));
|
||||
hwFS.append(hwAttr);
|
||||
|
||||
|
||||
// Create image fieldset
|
||||
var imgFS = $('<fieldset></fieldset>');
|
||||
var imgLegend = $('<legend>Image</legend>');
|
||||
imgFS.append(imgLegend);
|
||||
|
||||
|
||||
var imgAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
imgFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/operating_system.png"></img></div>'));
|
||||
imgFS.append(imgAttr);
|
||||
|
||||
|
||||
provForm.append(vmFS, hwFS, imgFS);
|
||||
|
||||
|
||||
// Create hypervisor input
|
||||
var host = $('<div></div>');
|
||||
var hostLabel = $('<label>Host:</label>');
|
||||
@ -255,14 +255,14 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
var hostInput = $('<input type="text" name="host"/>');
|
||||
host.append(hostInput);
|
||||
vmAttr.append(host);
|
||||
|
||||
|
||||
// Create group input
|
||||
var group = $('<div></div>');
|
||||
var groupLabel = $('<label>Group:</label>');
|
||||
group.append(groupLabel);
|
||||
|
||||
// Turn on auto complete for group
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
// Split group names into an array
|
||||
var tmp = groupNames.split(',');
|
||||
@ -298,7 +298,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
memory.append(memoryLabel);
|
||||
memory.append(memoryInput);
|
||||
hwAttr.append(memory);
|
||||
|
||||
|
||||
// Create processor dropdown
|
||||
var cpu = $('<div></div>');
|
||||
var cpuLabel = $('<label>Processor:</label>');
|
||||
@ -315,7 +315,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
cpu.append(cpuLabel);
|
||||
cpu.append(cpuSelect);
|
||||
hwAttr.append(cpu);
|
||||
|
||||
|
||||
// Create NIC dropdown
|
||||
var nic = $('<div></div>');
|
||||
var nicLabel = $('<label>NIC:</label>');
|
||||
@ -323,7 +323,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
nic.append(nicLabel);
|
||||
nic.append(nicInput);
|
||||
hwAttr.append(nic);
|
||||
|
||||
|
||||
// Create disk input
|
||||
var disk = $('<div></div>');
|
||||
var diskLabel = $('<label>Disk size:</label>');
|
||||
@ -334,7 +334,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
);
|
||||
disk.append(diskLabel, diskInput, diskSizeSelect);
|
||||
hwAttr.append(disk);
|
||||
|
||||
|
||||
// Create disk storage input
|
||||
var storage = $('<div></div>');
|
||||
var storageLabel = $('<label>Storage:</label>');
|
||||
@ -342,13 +342,13 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
storage.append(storageLabel);
|
||||
storage.append(storageInput);
|
||||
hwAttr.append(storage);
|
||||
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os"/>');
|
||||
osInput.one('focus', function() {
|
||||
var tmp = $.cookie('osvers');
|
||||
var tmp = $.cookie('xcat_osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -359,13 +359,13 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
imgAttr.append(os);
|
||||
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
var archLabel = $('<label>Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch"/>');
|
||||
archInput.one('focus', function() {
|
||||
var tmp = $.cookie('osarchs');
|
||||
var tmp = $.cookie('xcat_osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -376,13 +376,13 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
imgAttr.append(arch);
|
||||
|
||||
|
||||
// Create profile input
|
||||
var profile = $('<div></div>');
|
||||
var profileLabel = $('<label>Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile"/>');
|
||||
profileInput.one('focus', function() {
|
||||
var tmp = $.cookie('profiles');
|
||||
var tmp = $.cookie('xcat_profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -393,7 +393,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
imgAttr.append(profile);
|
||||
|
||||
|
||||
// Create boot method dropdown
|
||||
var method = $('<div></div>');
|
||||
var methodLabel = $('<label>Boot method:</label>');
|
||||
@ -417,10 +417,10 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
var ready = true;
|
||||
|
||||
|
||||
// Get tab ID
|
||||
var tabId = $(this).parents('.ui-tabs-panel').attr('id');
|
||||
|
||||
|
||||
// Check if fields are properly filled in
|
||||
var inputs = $('#' + tabId + ' input:visible');
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
@ -431,7 +431,7 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var selects = $('#' + tabId + ' select:visible');
|
||||
for ( var i = 0; i < selects.length; i++) {
|
||||
if (!selects.eq(i).val()) {
|
||||
@ -441,30 +441,30 @@ kvmPlugin.prototype.loadProvisionPage = function(tabId) {
|
||||
selects.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ready) {
|
||||
var inst = tabId.replace('kvmProvisionTab', '');
|
||||
|
||||
|
||||
// Prepend status bar
|
||||
var statBar = createStatusBar('kvmProvisionStatBar' + inst);
|
||||
statBar.append(createLoader(''));
|
||||
statBar.prependTo($('#' + tabId));
|
||||
|
||||
|
||||
var host = $('#' + tabId + ' input[name=host]').val();
|
||||
var group = $('#' + tabId + ' select[name=group]').val();
|
||||
var node = $('#' + tabId + ' input[name=node]').val();
|
||||
|
||||
|
||||
var memory = $('#' + tabId + ' input[name=memory]').val();
|
||||
var cpu = $('#' + tabId + ' select[name=cpu]').val();
|
||||
var nic = $('#' + tabId + ' input[name=nic]').val();
|
||||
var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
|
||||
var storage = $('#' + tabId + ' input[name=storage]').val();
|
||||
|
||||
|
||||
var os = $('#' + tabId + ' input[name=os]').val();
|
||||
var arch = $('#' + tabId + ' input[name=arch]').val();
|
||||
var profile = $('#' + tabId + ' input[name=profile]').val();
|
||||
var boot = $('#' + tabId + ' select[name=bootMethod]').val();
|
||||
|
||||
|
||||
/**
|
||||
* (1) Define node
|
||||
*/
|
||||
@ -512,14 +512,14 @@ kvmPlugin.prototype.loadResources = function() {
|
||||
var tabId = 'kvmResourceTab';
|
||||
// Remove loader
|
||||
$('#' + tabId).find('img').remove();
|
||||
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Not yet supported');
|
||||
|
||||
// Create resource form
|
||||
var resrcForm = $('<div class="form"></div>');
|
||||
resrcForm.append(infoBar);
|
||||
|
||||
|
||||
$('#' + tabId).append(resrcForm);
|
||||
};
|
||||
|
||||
@ -530,13 +530,13 @@ kvmPlugin.prototype.addNode = function() {
|
||||
var dialog = $('<div id="addKvm" class="form"></div>');
|
||||
var info = createInfoBar('Add a KVM node');
|
||||
dialog.append(info);
|
||||
|
||||
|
||||
// Create node inputs
|
||||
dialog.append($('<div><label>Node:</label><input name="node" type="text"></div>'));
|
||||
dialog.append($('<div><label>VM host:</label><input name="vmhost" type="text"></div>'));
|
||||
dialog.append($('<div><label>IP address:</label><input name="ip" type="text"></div>'));
|
||||
dialog.append($('<div><label>Groups:</label><input name="groups" type="text"></div>'));
|
||||
|
||||
|
||||
dialog.dialog({
|
||||
title: 'Add node',
|
||||
modal: true,
|
||||
@ -555,13 +555,13 @@ kvmPlugin.prototype.addNode = function() {
|
||||
function addKvmNode(){
|
||||
var attr, args;
|
||||
var errorMessage = '';
|
||||
|
||||
|
||||
// Remove existing warnings
|
||||
$('#addKvm .ui-state-error').remove();
|
||||
|
||||
|
||||
// Return input border colors to normal
|
||||
$('#addKvm input').css('border', 'solid #BDBDBD 1px');
|
||||
|
||||
|
||||
// Check node attributes
|
||||
$('#addKvm input').each(function(){
|
||||
attr = $(this).val();
|
||||
@ -570,28 +570,28 @@ function addKvmNode(){
|
||||
$(this).css('border', 'solid #FF0000 1px');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Show error message (if any)
|
||||
if (errorMessage) {
|
||||
$('#addKvm').prepend(createWarnBar(errorMessage));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Create loader
|
||||
$('#addKvm').append(createLoader());
|
||||
|
||||
|
||||
// Change dialog buttons
|
||||
$('#addKvm').dialog('option', 'buttons', {
|
||||
'Close':function(){
|
||||
$('#addKvm').dialog('destroy').remove();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Generate chdef arguments
|
||||
args = '-t;node;-o;' + $('#addKvm input[name="node"]').val()
|
||||
+ ';ip=' + $('#addKvm input[name="ip"]').val()
|
||||
+ ';groups=' + $('#addKvm input[name="groups"]').val()
|
||||
+ ';vmhost=' + $('#addKvm input[name="vmhost"]').val()
|
||||
+ ';groups=' + $('#addKvm input[name="groups"]').val()
|
||||
+ ';vmhost=' + $('#addKvm input[name="vmhost"]').val()
|
||||
+ ';mgt=kvm;netboot=xnba;nodetype=osi;profile=compute';
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@ -614,16 +614,16 @@ function addKvmNode(){
|
||||
msg : ''
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Remove loader
|
||||
$('#addKvm img').remove();
|
||||
|
||||
|
||||
// Get return message
|
||||
var message = '';
|
||||
for (var i in data.rsp) {
|
||||
message += data.rsp[i] + '<br/>';
|
||||
}
|
||||
|
||||
|
||||
// Show return message
|
||||
if (message)
|
||||
$('#addKvm').prepend(createInfoBar(message));
|
||||
@ -633,7 +633,7 @@ function addKvmNode(){
|
||||
|
||||
/**
|
||||
* Update the provision node status
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateKVMProvisionStatus(data) {
|
||||
@ -645,24 +645,24 @@ function updateKVMProvisionStatus(data) {
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
// Get provision tab instance
|
||||
var inst = args[1].replace('out=', '');
|
||||
|
||||
|
||||
// Get provision tab and status bar ID
|
||||
var statBarId = 'kvmProvisionStatBar' + inst;
|
||||
var tabId = 'kvmProvisionTab' + inst;
|
||||
|
||||
|
||||
var node = $('#' + tabId + ' input[name=node]').val();
|
||||
|
||||
|
||||
/**
|
||||
* (2) Create virtual machine
|
||||
*/
|
||||
if (cmd == 'chdef') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Get parameters
|
||||
var disk = $('#' + tabId + ' input[name=disk]').val() + $('#' + tabId + ' select[name=diskUnit]').val();
|
||||
|
||||
|
||||
// Begin installation
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -676,19 +676,19 @@ function updateKVMProvisionStatus(data) {
|
||||
|
||||
success : updateKVMProvisionStatus
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* (3) Prepare node for boot
|
||||
*/
|
||||
if (cmd == 'mkvm') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
|
||||
// Get provision method
|
||||
var boot = $('#' + tabId + ' select[name=bootMethod]').val();
|
||||
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -703,14 +703,14 @@ function updateKVMProvisionStatus(data) {
|
||||
success : updateKVMProvisionStatus
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (4) Power on node
|
||||
*/
|
||||
if (cmd == 'nodeset') {
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -725,16 +725,16 @@ function updateKVMProvisionStatus(data) {
|
||||
success : updateKVMProvisionStatus
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (5) Done
|
||||
*/
|
||||
else if (cmd == 'rpower') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
$('#' + statBarId).find('img').remove();
|
||||
|
||||
|
||||
// If installation was successful
|
||||
if (prg.html().indexOf('Error') == -1) {
|
||||
$('#' + statBarId).find('div').append('<pre>It will take several minutes before the nodes are up and ready. Use rcons to monitor the status of the install.</pre>');
|
||||
|
@ -166,7 +166,7 @@ zvmPlugin.prototype.loadServiceProvisionPage = function(tabId) {
|
||||
loadGoldenImages(imgCol);
|
||||
|
||||
// Get zVM host names
|
||||
if (!$.cookie('zvms')){
|
||||
if (!$.cookie('xcat_zvms')){
|
||||
$.ajax( {
|
||||
url : 'lib/srv_cmd.php',
|
||||
dataType : 'json',
|
||||
@ -669,7 +669,7 @@ zvmPlugin.prototype.loadClonePage = function(node, nodeOS, nodeArch) {
|
||||
var groupLabel = $('<label>Group:</label>');
|
||||
var groupInput = $('<input type="text" id="newGroup" name="newGroup" title="You must give the group where the new node(s) will be placed under."/>');
|
||||
groupInput.one('focus', function(){
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -704,7 +704,7 @@ zvmPlugin.prototype.loadClonePage = function(node, nodeOS, nodeArch) {
|
||||
}
|
||||
// Get list of disk pools
|
||||
var temp = hcp.split('.');
|
||||
var diskPools = $.cookie(temp[0] + 'diskpools');
|
||||
var diskPools = $.cookie('xcat_' + temp[0] + 'diskpools');
|
||||
|
||||
// Create disk pool input
|
||||
var poolDiv = $('<div></div>');
|
||||
@ -992,7 +992,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
// Get node
|
||||
var node = args[1].replace('node=', '');
|
||||
// Clear any existing cookie
|
||||
$.cookie(node + 'processes', null);
|
||||
$.cookie('xcat_' + node + 'processes', null, {path: '/xcat', secure:true });
|
||||
|
||||
// Remove loader
|
||||
$('#' + tabId).find('img').remove();
|
||||
@ -1127,7 +1127,7 @@ zvmPlugin.prototype.loadInventory = function(data) {
|
||||
// Start off an ajax request to save the zhcp node name
|
||||
// in a cookie for possible later use by addNic dialog
|
||||
var hcpHostname = attrs['hcp'];
|
||||
if (!$.cookie(node+'_hcpnodename')){
|
||||
if (!$.cookie('xcat_' + node+'_hcpnodename')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -2310,7 +2310,7 @@ zvmPlugin.prototype.addNode = function() {
|
||||
* @param tgtNode Targets to migrate
|
||||
*/
|
||||
zvmPlugin.prototype.loadMigratePage = function(tgtNode, fromhcp) {
|
||||
var hosts = $.cookie('zvms').split(',');
|
||||
var hosts = $.cookie('xcat_zvms').split(',');
|
||||
var radio, zvmBlock, args;
|
||||
var zvms = new Array();
|
||||
var hcp = new Object();
|
||||
|
@ -124,7 +124,7 @@ function loadHcpInfo(data) {
|
||||
if (userEntry[0].indexOf('Failed') < 0) {
|
||||
if (hcp) {
|
||||
// If there is no cookie for the disk pool names
|
||||
if (!$.cookie(hcp + 'diskpools') || $.cookie(hcp + 'diskpools') === null) {
|
||||
if (!$.cookie('xcat_' + hcp + 'diskpools') || $.cookie('xcat_' + hcp + 'diskpools') === null) {
|
||||
if (nodeInfoBar !== null) {
|
||||
nodeInfoBar.append("<BR>Finding pools and networks...");
|
||||
findingPools = 1;
|
||||
@ -152,7 +152,7 @@ function loadHcpInfo(data) {
|
||||
}
|
||||
|
||||
// If there is no cookie for the zFCP pool names
|
||||
if (!$.cookie(hcp + 'zfcppools') || $.cookie(hcp + 'zfcppools') === null) {
|
||||
if (!$.cookie('xcat_' + hcp + 'zfcppools') || $.cookie('xcat_' + hcp + 'zfcppools') === null) {
|
||||
|
||||
if (nodeInfoBar !== null) {
|
||||
if (findingPools = 0) {
|
||||
@ -183,7 +183,7 @@ function loadHcpInfo(data) {
|
||||
}
|
||||
|
||||
// If there is no cookie for the network names
|
||||
if (!$.cookie(hcp + 'networks') || $.cookie(hcp + 'networks') === null) {
|
||||
if (!$.cookie('xcat_' + hcp + 'networks') || $.cookie('xcat_' + hcp + 'networks') === null) {
|
||||
|
||||
if (nodeInfoBar !== null) {
|
||||
if (findingPools = 0) {
|
||||
@ -374,13 +374,13 @@ function loadUserEntry(data) {
|
||||
*/
|
||||
function incrementNodeProcess(node) {
|
||||
// Get current processes
|
||||
var procs = $.cookie(node + 'processes');
|
||||
var procs = $.cookie('xcat_' + node + 'processes');
|
||||
if (procs) {
|
||||
// One more process
|
||||
procs = parseInt(procs) + 1;
|
||||
$.cookie(node + 'processes', procs);
|
||||
$.cookie('xcat_' + node + 'processes', procs);
|
||||
} else {
|
||||
$.cookie(node + 'processes', 1);
|
||||
$.cookie('xcat_' + node + 'processes', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ function updateZProvisionNewStatus(data) {
|
||||
|
||||
// Set cookie for number of disks
|
||||
var diskRows = $('#' + tabId + ' table:eq(0):visible tbody tr');
|
||||
$.cookie('disks2add' + out2Id, diskRows.length);
|
||||
$.cookie('xcat_disks2add' + out2Id, diskRows.length, {path: '/xcat', secure:true });
|
||||
if (diskRows.length > 0) {
|
||||
for (var i = 0; i < diskRows.length; i++) {
|
||||
var diskArgs = diskRows.eq(i).find('td');
|
||||
@ -558,7 +558,7 @@ function updateZProvisionNewStatus(data) {
|
||||
|
||||
// Set cookie for number of zFCP devices
|
||||
var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr');
|
||||
$.cookie('zfcp2add' + out2Id, zfcpRows.length);
|
||||
$.cookie('xcat_zfcp2add' + out2Id, zfcpRows.length, {path: '/xcat', secure:true });
|
||||
if (zfcpRows.length > 0) {
|
||||
for ( var i = 0; i < zfcpRows.length; i++) {
|
||||
var diskArgs = zfcpRows.eq(i).find('td');
|
||||
@ -581,10 +581,16 @@ function updateZProvisionNewStatus(data) {
|
||||
var args = '--addzfcp;' + pool + ';' + address + ';' + loaddev + ';' + size;
|
||||
if (tag && tag != "null") {
|
||||
args += ';' + tag;
|
||||
} else {
|
||||
args += ';';
|
||||
} if (portName && tag != "null") {
|
||||
args += ';' + portName;
|
||||
} else {
|
||||
args += ';';
|
||||
} if (unitNo && tag != "null") {
|
||||
args += ';' + unitNo;
|
||||
} else {
|
||||
args += ';';
|
||||
}
|
||||
|
||||
// Attach zFCP device to node
|
||||
@ -625,19 +631,19 @@ function updateZProvisionNewStatus(data) {
|
||||
} else {
|
||||
// Set cookie for number of disks
|
||||
// One less disk to add
|
||||
var disks2add = $.cookie('disks2add' + out2Id);
|
||||
var disks2add = $.cookie('xcat_disks2add' + out2Id);
|
||||
if (lastCmd == 'chvm-disk') {
|
||||
if (disks2add > 0) {
|
||||
disks2add--;
|
||||
$.cookie('disks2add' + out2Id, disks2add);
|
||||
$.cookie('xcat_disks2add' + out2Id, disks2add, {path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
var zfcp2add = $.cookie('zfcp2add' + out2Id);
|
||||
var zfcp2add = $.cookie('xcat_zfcp2add' + out2Id);
|
||||
if (lastCmd == 'chvm-zfcp') {
|
||||
if (zfcp2add > 0) {
|
||||
zfcp2add--;
|
||||
$.cookie('zfcp2add' + out2Id, zfcp2add);
|
||||
$.cookie('xcat_zfcp2add' + out2Id, zfcp2add, {path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -887,10 +893,10 @@ function updateZNodeStatus(data) {
|
||||
var rsp = data.rsp;
|
||||
|
||||
// Get cookie for number processes performed against this node
|
||||
var actions = $.cookie(node + 'processes');
|
||||
var actions = $.cookie('xcat_' + node + 'processes');
|
||||
// One less process
|
||||
actions = actions - 1;
|
||||
$.cookie(node + 'processes', actions);
|
||||
$.cookie('xcat_' + node + 'processes', actions, {path: '/xcat', secure:true });
|
||||
|
||||
if (actions < 1) {
|
||||
// Hide loader when there are no more processes
|
||||
@ -1116,7 +1122,7 @@ function getZResources(data) {
|
||||
}
|
||||
|
||||
// Set hardware control point cookie
|
||||
$.cookie('hcp', hcps);
|
||||
$.cookie('xcat_hcp', hcps, {path: '/xcat', secure:true });
|
||||
|
||||
// Delete loader
|
||||
$('#' + tabId).find('img[src="images/loader.gif"]').remove();
|
||||
@ -1137,10 +1143,10 @@ function getZResources(data) {
|
||||
|
||||
// Create a array for hardware control points
|
||||
var hcps = new Array();
|
||||
if ($.cookie('hcp').indexOf(',') > -1) {
|
||||
hcps = $.cookie('hcp').split(',');
|
||||
if ($.cookie('xcat_hcp').indexOf(',') > -1) {
|
||||
hcps = $.cookie('xcat_hcp').split(',');
|
||||
} else {
|
||||
hcps.push($.cookie('hcp'));
|
||||
hcps.push($.cookie('xcat_hcp'));
|
||||
}
|
||||
|
||||
// Query the disk pools for each hcp
|
||||
@ -1185,10 +1191,10 @@ function getZResources(data) {
|
||||
|
||||
// Create a array for hardware control points
|
||||
var hcps = new Array();
|
||||
if ($.cookie('hcp').indexOf(',') > -1) {
|
||||
hcps = $.cookie('hcp').split(',');
|
||||
if ($.cookie('xcat_hcp').indexOf(',') > -1) {
|
||||
hcps = $.cookie('xcat_hcp').split(',');
|
||||
} else {
|
||||
hcps.push($.cookie('hcp'));
|
||||
hcps.push($.cookie('xcat_hcp'));
|
||||
|
||||
}
|
||||
|
||||
@ -1235,10 +1241,10 @@ function getZResources(data) {
|
||||
|
||||
// Create a array for hardware control points
|
||||
var hcps = new Array();
|
||||
if ($.cookie('hcp').indexOf(',') > -1) {
|
||||
hcps = $.cookie('hcp').split(',');
|
||||
if ($.cookie('xcat_hcp').indexOf(',') > -1) {
|
||||
hcps = $.cookie('xcat_hcp').split(',');
|
||||
} else {
|
||||
hcps.push($.cookie('hcp'));
|
||||
hcps.push($.cookie('xcat_hcp'));
|
||||
|
||||
}
|
||||
// Query the networks for each
|
||||
@ -1442,7 +1448,7 @@ function openAddProcDialog(node) {
|
||||
*/
|
||||
function openAddDiskDialog(node, hcp) {
|
||||
// Get list of disk pools
|
||||
var cookie = $.cookie(hcp + 'diskpools');
|
||||
var cookie = $.cookie('xcat_' + hcp + 'diskpools');
|
||||
var pools = new Array();
|
||||
if (cookie) {
|
||||
pools = cookie.split(',');
|
||||
@ -1605,7 +1611,7 @@ function openAddDiskDialog(node, hcp) {
|
||||
*/
|
||||
function openAddZfcpDialog(node, hcp, zvm) {
|
||||
// Get list of disk pools
|
||||
var cookie = $.cookie(hcp + 'zfcppools');
|
||||
var cookie = $.cookie('xcat_' + hcp + 'zfcppools');
|
||||
var pools = new Array();
|
||||
if (cookie) {
|
||||
pools = cookie.split(',');
|
||||
@ -2492,8 +2498,8 @@ function openAddScsi2SystemDialog(hcp) {
|
||||
var fcpWwpn = $('<td><input type="text" style="width: 100px;" name="fcpWwpn" maxlength="16" title="The FCP world wide port number"/></td>');
|
||||
devPathRow.append(fcpWwpn);
|
||||
|
||||
if ($.cookie('zvms')) {
|
||||
zvms = $.cookie('zvms').split(',');
|
||||
if ($.cookie('xcat_zvms')) {
|
||||
zvms = $.cookie('xcat_zvms').split(',');
|
||||
var zvm;
|
||||
for (var i in zvms) {
|
||||
if( !zvms[i] || 0 === zvms[i].length) continue;
|
||||
@ -2807,7 +2813,7 @@ function openAddNicDialog(node, hcp) {
|
||||
|
||||
// Get the hcp node name for the node
|
||||
// Should be in a cookie, else just take first part of hostname
|
||||
var hcpNode = $.cookie(node+'_hcpnodename');
|
||||
var hcpNode = $.cookie('xcat_' + node+'_hcpnodename');
|
||||
if (!hcpNode) {
|
||||
if (typeof console == "object"){
|
||||
console.log("openAddNicDialog did not find cookie for <"+node+"_hcpnodename> Using first token in hostname");
|
||||
@ -2819,7 +2825,7 @@ function openAddNicDialog(node, hcp) {
|
||||
}
|
||||
|
||||
// Get network names
|
||||
var cookie = $.cookie(hcpNode + 'networks');
|
||||
var cookie = $.cookie('xcat_' + hcpNode + 'networks');
|
||||
var networks = new Array();
|
||||
if (cookie) {
|
||||
networks = cookie.split(',');
|
||||
@ -3772,14 +3778,14 @@ function removeNic(node, nic) {
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
function setNetworkCookies(data) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var node = data.msg;
|
||||
var networks = data.rsp[0].split(node + ': ');
|
||||
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
|
||||
$.cookie(node + 'networks', networks, { expires: exDate });
|
||||
$.cookie('xcat_' + node + 'networks', networks, { expires: exDate, path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -3789,7 +3795,7 @@ function setNetworkCookies(data) {
|
||||
* @param data HTTP request data
|
||||
*/
|
||||
function getDiskPool(data) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var hcp = data.msg;
|
||||
var pools = data.rsp[0].split(hcp + ': ');
|
||||
|
||||
@ -3854,9 +3860,10 @@ function getZfcpPool(data) {
|
||||
if (typeof console == "object"){
|
||||
console.log("Entering getZfcpPool.");
|
||||
}
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var hcp = data.msg;
|
||||
var pools = data.rsp[0].split(hcp + ': ');
|
||||
zhcpQueryCountForZfcps = 0;
|
||||
// Get contents of each disk pool
|
||||
for (var i in pools) {
|
||||
pools[i] = jQuery.trim(pools[i]);
|
||||
@ -3900,7 +3907,7 @@ function getZfcpPool(data) {
|
||||
* @param data HTTP request data
|
||||
*/
|
||||
function getNetwork(data) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Invalid") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var hcp = data.msg;
|
||||
var networks = data.rsp[0].split(hcp + ': ');
|
||||
if (typeof console == "object"){
|
||||
@ -3962,7 +3969,7 @@ function loadDiskPoolTable(data) {
|
||||
var args, hcp, pool, stat, tmp;
|
||||
if (data && typeof data.rsp != "undefined") {
|
||||
// Do not continue if the call failed
|
||||
if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) {
|
||||
if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0 && data.rsp[0].indexOf("Error") > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4065,10 +4072,10 @@ function loadDiskPoolTable(data) {
|
||||
|
||||
// Create a array for hardware control points
|
||||
var hcps = new Array();
|
||||
if ($.cookie('hcp').indexOf(',') > -1)
|
||||
hcps = $.cookie('hcp').split(',');
|
||||
if ($.cookie('xcat_hcp').indexOf(',') > -1)
|
||||
hcps = $.cookie('xcat_hcp').split(',');
|
||||
else
|
||||
hcps.push($.cookie('hcp'));
|
||||
hcps.push($.cookie('xcat_hcp'));
|
||||
|
||||
zhcpQueryCountForDisks = hcps.length;
|
||||
// Query the disk pools for each
|
||||
@ -4179,15 +4186,45 @@ function loadZfcpPoolTable(data) {
|
||||
}
|
||||
// Delete loader if last one
|
||||
var panelId = 'zfcpResource';
|
||||
if (!zhcpQueryCountForZfcps) {
|
||||
if (zhcpQueryCountForZfcps <= 0) {
|
||||
$('#' + panelId).find('img[src="images/loader.gif"]').remove();
|
||||
}
|
||||
|
||||
var hcp2zvm = new Object();
|
||||
var args, hcp, pool, tmp;
|
||||
|
||||
// Resource tab ID
|
||||
var info = $('#' + panelId).find('.ui-state-highlight');
|
||||
|
||||
// Is there any data passed? Process if some
|
||||
if (typeof data.rsp != "undefined") {
|
||||
// Do not continue if the call failed
|
||||
if (!data.rsp.length && data.rsp[0].indexOf("Failed") > 0) {
|
||||
// Do not continue if no data to add
|
||||
if (!data.rsp.length) {
|
||||
if (typeof console == "object"){
|
||||
console.log("data.rsp.length is 0.");
|
||||
}
|
||||
// If there is no info bar, create info bar
|
||||
var msgError = '<br>Unexpected, no data returned on the lsvm --zfcppool call.';
|
||||
if (!info.length) {
|
||||
info = createInfoBar(msgError);
|
||||
$('#' + panelId).append(info);
|
||||
} else {
|
||||
info.append(msgError);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (data.rsp[0].indexOf("Failed") > 0 || data.rsp[0].indexOf("Error") > 0) {
|
||||
if (typeof console == "object"){
|
||||
console.log("Failed on lsvm call for --zfcppool");
|
||||
}
|
||||
var msgError = '<br>Error: Error on call to check zfcp pools: '+ data.rsp[0];
|
||||
// If there is no info bar, create info bar
|
||||
if (!info.length) {
|
||||
info = createInfoBar(msgError);
|
||||
$('#' + panelId).append(info);
|
||||
} else {
|
||||
info.append(msgError);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -4200,13 +4237,14 @@ function loadZfcpPoolTable(data) {
|
||||
tmp = data.rsp[0].split(hcp + ': ');
|
||||
} else {
|
||||
// Provide empty values so the table will be generated
|
||||
if (typeof console == "object"){
|
||||
console.log("Creating empty zfcp pool table.");
|
||||
}
|
||||
hcp = '';
|
||||
pool = ''
|
||||
tmp = new Array();
|
||||
}
|
||||
|
||||
// Resource tab ID
|
||||
var info = $('#' + panelId).find('.ui-state-highlight');
|
||||
// If there is no info bar, create info bar
|
||||
if (!info.length) {
|
||||
info = createInfoBar('Below are devices that are defined internally in the zFCP pools.');
|
||||
@ -4248,7 +4286,8 @@ function loadZfcpPoolTable(data) {
|
||||
tmp[i] = jQuery.trim(tmp[i]);
|
||||
var diskAttrs = tmp[i].split(',');
|
||||
diskAttrs[0] = diskAttrs[0].toLowerCase();
|
||||
var key = hcp2zvm[hcp] + '-' + pool + '-' + diskAttrs[2];
|
||||
// Key contains row data to be returned when the checkbox is selected
|
||||
var key = hcp2zvm[hcp] + '-' + pool + '-' + diskAttrs[2] + '-' + diskAttrs[1];
|
||||
dTable.fnAddData( [ '<input type="checkbox" name="' + key + '"/>', hcp2zvm[hcp], pool, diskAttrs[0], diskAttrs[1], diskAttrs[2], diskAttrs[3], diskAttrs[4], diskAttrs[5], diskAttrs[6], diskAttrs[7] ]);
|
||||
}
|
||||
}
|
||||
@ -4266,6 +4305,9 @@ function loadZfcpPoolTable(data) {
|
||||
// Delete disk from pool
|
||||
var removeLnk = $('<a>Remove</a>');
|
||||
removeLnk.bind('click', function(event){
|
||||
if (typeof console == "object"){
|
||||
console.log("Remove button clicked for tableId:"+tableId);
|
||||
}
|
||||
var disks = getNodesChecked(tableId);
|
||||
openRemoveZfcpFromPoolDialog(disks);
|
||||
});
|
||||
@ -4278,10 +4320,10 @@ function loadZfcpPoolTable(data) {
|
||||
|
||||
// Create a array for hardware control points
|
||||
var hcps = new Array();
|
||||
if ($.cookie('hcp').indexOf(',') > -1)
|
||||
hcps = $.cookie('hcp').split(',');
|
||||
if ($.cookie('xcat_hcp').indexOf(',') > -1)
|
||||
hcps = $.cookie('xcat_hcp').split(',');
|
||||
else
|
||||
hcps.push($.cookie('hcp'));
|
||||
hcps.push($.cookie('xcat_hcp'));
|
||||
|
||||
// Query the disk pools for each
|
||||
zhcpQueryCountForZfcps = hcps.length;
|
||||
@ -4643,7 +4685,11 @@ function openRemoveZfcpFromPoolDialog(devices2remove) {
|
||||
|
||||
// Verify disks are in the same zFCP pool
|
||||
var devices = devices2remove.split(',');
|
||||
if (typeof console == "object"){
|
||||
console.log("Entering openRemoveZfcpFromPoolDialog. Device to remove:<"+devices2remove+">");
|
||||
}
|
||||
var tmp, tgtPool, tgtHcp;
|
||||
var tgtPort = "";
|
||||
var tgtUnitNo = "";
|
||||
for (var i in devices) {
|
||||
if( !devices[i] || 0 === devices[i].length) continue;
|
||||
@ -4658,6 +4704,7 @@ function openRemoveZfcpFromPoolDialog(devices2remove) {
|
||||
|
||||
tgtHcp = tmp[0]; // Assume it is just one zHCP. Otherwise, this cannot be done on multiple zHCPs.
|
||||
tgtUnitNo += tmp[2] + ",";
|
||||
tgtPort = tmp[3];
|
||||
}
|
||||
|
||||
// Strip out last comma
|
||||
@ -4673,7 +4720,7 @@ function openRemoveZfcpFromPoolDialog(devices2remove) {
|
||||
|
||||
var pool = $('<div><label>zFCP pool:</label><input type="text" name="zfcpPool" value="' + tgtPool + '" title="The pool where the disk resides"/></div>');
|
||||
var unitNo = $('<div><label>Unit number:</label><input type="text" name="zfcpUnitNo" value="' + tgtUnitNo + '" title="The hexadecimal digits representing the 8-byte logical unit number of the FCP-I/O device"/></div>');
|
||||
var portName = $('<div><label>Port name:</label><input type="text" name="zfcpPortName" title="Optional. The hexadecimal digits designating the 8-byte fibre channel port name of the FCP-I/O device"/></div>');
|
||||
var portName = $('<div><label>Port name:</label><input type="text" name="zfcpPortName" value="'+ tgtPort + '"title="The hexadecimal digits designating the 8-byte fibre channel port name of the FCP-I/O device"/></div>');
|
||||
deleteDiskForm.append(system, pool, unitNo, portName);
|
||||
|
||||
// Append options for hardware control points
|
||||
@ -4760,7 +4807,9 @@ function openRemoveZfcpFromPoolDialog(devices2remove) {
|
||||
msg : dialogId
|
||||
},
|
||||
|
||||
success : updateResourceDialog
|
||||
success : function(data) {
|
||||
updateResourceDialog(data);
|
||||
}
|
||||
});
|
||||
},
|
||||
"Cancel": function() {
|
||||
@ -4984,7 +5033,7 @@ function loadNetworkTable(data) {
|
||||
}
|
||||
|
||||
// Get zVM host names
|
||||
if (!$.cookie('zvms')) {
|
||||
if (!$.cookie('xcat_zvms')) {
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -5002,7 +5051,7 @@ function loadNetworkTable(data) {
|
||||
});
|
||||
}
|
||||
|
||||
var zvms = $.cookie('zvms').split(',');
|
||||
var zvms = $.cookie('xcat_zvms').split(',');
|
||||
var hcp2zvm = new Object();
|
||||
var args, zvm, iHcp, tmp;
|
||||
for (var i in zvms) {
|
||||
@ -5132,10 +5181,10 @@ function loadNetworkTable(data) {
|
||||
|
||||
// Create a array for hardware control points
|
||||
var hcps = new Array();
|
||||
if ($.cookie('hcp').indexOf(',') > -1)
|
||||
hcps = $.cookie('hcp').split(',');
|
||||
if ($.cookie('xcat_hcp').indexOf(',') > -1)
|
||||
hcps = $.cookie('xcat_hcp').split(',');
|
||||
else
|
||||
hcps.push($.cookie('hcp'));
|
||||
hcps.push($.cookie('xcat_hcp'));
|
||||
|
||||
// Query networks
|
||||
zhcpQueryCountForNetworks = hcps.length;
|
||||
@ -5206,7 +5255,7 @@ function connect2GuestLan(data) {
|
||||
$('#' + node + 'StatusBar').find('div').append(prg);
|
||||
|
||||
// Continue if no errors found
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
// Connect NIC to Guest LAN
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -5261,7 +5310,7 @@ function connect2VSwitch(data) {
|
||||
$('#' + node + 'StatusBar').find('div').append(prg);
|
||||
|
||||
// Continue if no errors found
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
// Connect NIC to VSwitch
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -5317,7 +5366,7 @@ function createZProvisionExisting(inst) {
|
||||
group.append(groupLabel);
|
||||
|
||||
// Turn on auto complete for group
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
// Split group names into an array
|
||||
var tmp = groupNames.split(',');
|
||||
@ -5363,7 +5412,7 @@ function createZProvisionExisting(inst) {
|
||||
var osSelect = $('<select name="os" title="The operating system image to be installed on this node"></select>');
|
||||
osSelect.append($('<option value=""></option>'));
|
||||
|
||||
var imageNames = $.cookie('imagenames').split(',');
|
||||
var imageNames = $.cookie('xcat_imagenames').split(',');
|
||||
if (imageNames) {
|
||||
imageNames.sort();
|
||||
for (var i in imageNames) {
|
||||
@ -5542,7 +5591,7 @@ function createZProvisionNew(inst) {
|
||||
var groupInput = $('<input type="text" name="group" title="You must give the group name that the node(s) will be placed under"/>');
|
||||
// Get groups on-focus
|
||||
groupInput.one('focus', function(){
|
||||
var groupNames = $.cookie('groups');
|
||||
var groupNames = $.cookie('xcat_groups');
|
||||
if (groupNames) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -5603,7 +5652,7 @@ function createZProvisionNew(inst) {
|
||||
},
|
||||
|
||||
success: function(data) {
|
||||
if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || data.rsp[0].indexOf("Invalid") > -1) ) {
|
||||
if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || data.rsp[0].indexOf("Invalid") > -1 || data.rsp[0].indexOf("Error") > -1) ) {
|
||||
// Remove the progress gif, since bailing out
|
||||
removeProvisionLoadingGif(provisionStatusBar);
|
||||
|
||||
@ -5711,7 +5760,7 @@ function createZProvisionNew(inst) {
|
||||
console.log("Looking for cookies from <" + zhcpToCheck + ">");
|
||||
}
|
||||
|
||||
if (!$.cookie(zhcpToCheck + 'diskpools')) {
|
||||
if (!$.cookie('xcat_' + zhcpToCheck + 'diskpools')) {
|
||||
// Get disk pools
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@ -5732,7 +5781,7 @@ function createZProvisionNew(inst) {
|
||||
checkProvisionCallsDone(provisionStatusBar, ajaxCalls, "diskpoolnames");
|
||||
}
|
||||
|
||||
if (!$.cookie(zhcpToCheck + 'zfcppools')) {
|
||||
if (!$.cookie('xcat_' + zhcpToCheck + 'zfcppools')) {
|
||||
// Get zFCP pools
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@ -5753,7 +5802,7 @@ function createZProvisionNew(inst) {
|
||||
checkProvisionCallsDone(provisionStatusBar, ajaxCalls, "zfcppoolnames");
|
||||
}
|
||||
|
||||
if (!$.cookie(zhcpToCheck + 'userprofiles')) {
|
||||
if (!$.cookie('xcat_' + zhcpToCheck + 'userprofiles')) {
|
||||
// Get zFCP pools
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -5780,7 +5829,7 @@ function createZProvisionNew(inst) {
|
||||
var thisUserProfile = $('#' + thisTabId + ' select[name=userProfile]');
|
||||
thisUserProfile.children().remove();
|
||||
|
||||
var definedUserProfiles = $.cookie(zhcpToCheck + 'userprofiles').split(',');
|
||||
var definedUserProfiles = $.cookie('xcat_' + zhcpToCheck + 'userprofiles').split(',');
|
||||
for (var i in definedUserProfiles) {
|
||||
if( !definedUserProfiles[i] || 0 === definedUserProfiles[i].length) continue;
|
||||
thisUserProfile.append('<option value="' + definedUserProfiles[i] + '">' + definedUserProfiles[i] + '</option>');
|
||||
@ -5789,7 +5838,7 @@ function createZProvisionNew(inst) {
|
||||
var thisNetwork = $('#' + thisTabId + ' select[name=network]');
|
||||
thisNetwork.children().remove();
|
||||
thisNetwork.append('<option value=""></option>'); // No profile option
|
||||
var definedNetworks = $.cookie(zhcpToCheck + 'networks').split(',');
|
||||
var definedNetworks = $.cookie('xcat_' + zhcpToCheck + 'networks').split(',');
|
||||
for (var i in definedNetworks) {
|
||||
if( !definedNetworks[i] || 0 === definedNetworks[i].length) continue;
|
||||
if (!jQuery.trim(definedNetworks[i]))
|
||||
@ -5854,7 +5903,7 @@ function createZProvisionNew(inst) {
|
||||
var osSelect = $('<select name="os" title="The operating system image to be installed on this node"></select>');
|
||||
osSelect.append($('<option value=""></option>'));
|
||||
|
||||
var imageNames = $.cookie('imagenames').split(',');
|
||||
var imageNames = $.cookie('xcat_imagenames').split(',');
|
||||
if (imageNames) {
|
||||
imageNames.sort();
|
||||
for (var i in imageNames) {
|
||||
@ -5939,7 +5988,6 @@ function createZProvisionNew(inst) {
|
||||
'<option value="">Select a hardware control point</option>' +
|
||||
'</select></div>');
|
||||
var cpuSelect = $('<select name="cpuCount" title="The number of CPUs assigned to the virtual machine">' +
|
||||
'<option value=""></option>' +
|
||||
'<option value="1">1</option>' +
|
||||
'<option value="2">2</option>' +
|
||||
'<option value="3">3</option>' +
|
||||
@ -6036,7 +6084,7 @@ function createZProvisionNew(inst) {
|
||||
if (thisHcp) {
|
||||
// Get node without domain name
|
||||
var temp = thisHcp.split('.');
|
||||
definedPools = $.cookie(temp[0] + 'diskpools').split(',');
|
||||
definedPools = $.cookie('xcat_' + temp[0] + 'diskpools').split(',');
|
||||
} else {
|
||||
var warning = createWarnBar('You must fill in a hardware control point before adding a disk.');
|
||||
var warnDialog = $('<div></div>').append(warning);
|
||||
@ -6176,7 +6224,7 @@ function createZProvisionNew(inst) {
|
||||
if (thisHcp) {
|
||||
// Get node without domain name
|
||||
var temp = thisHcp.split('.');
|
||||
definedPools = $.cookie(temp[0] + 'zfcppools').split(',');
|
||||
definedPools = $.cookie('xcat_' + temp[0] + 'zfcppools').split(',');
|
||||
} else {
|
||||
var warning = createWarnBar('You must fill in a hardware control point before adding a zFCP.');
|
||||
var warnDialog = $('<div></div>').append(warning);
|
||||
@ -6227,7 +6275,7 @@ function createZProvisionNew(inst) {
|
||||
zfcpRow.append(zfcpPool);
|
||||
|
||||
// Create disk tag
|
||||
var zfcpTag = $('<td><input type="text" name="zfcpTag" title="Optional. You can give a tag for the device. The tag determines how this device will be used."/></td>');
|
||||
var zfcpTag = $('<td><input type="text" name="zfcpTag" title="Optional. You can enter a tag for the device ex: replace_root_device. This device address will be substituted in the autoyast/kickstart template"/></td>');
|
||||
zfcpRow.append(zfcpTag);
|
||||
|
||||
// Create device port name
|
||||
@ -6399,6 +6447,35 @@ function createZProvisionNew(inst) {
|
||||
ready = false;
|
||||
}
|
||||
|
||||
// If this is basic mode, check for a disk with IPL radio button and zFCP with LOADDEV button
|
||||
// Cannot have both. (In advanced mode they create the directory entries.)
|
||||
if (hwTabIndex == 0) {
|
||||
// Find a device to be IPLed?
|
||||
var ECKD_FBA_diskRows = $('#' + thisTabId + ' table:eq(0):visible tbody tr');
|
||||
var iplSet = 0;
|
||||
for (var i = 0; i < ECKD_FBA_diskRows.length; i++) {
|
||||
var diskArgs = ECKD_FBA_diskRows.eq(i).find('td');
|
||||
if (diskArgs.eq(7).find('input').attr("checked") === true) {
|
||||
iplSet = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if zFCP loaddev checked
|
||||
var zfcpRows = $('#' + thisTabId + ' table:eq(1):visible tbody tr');
|
||||
if (zfcpRows.length > 0) {
|
||||
for ( var i = 0; i < zfcpRows.length; i++) {
|
||||
var diskArgs = zfcpRows.eq(i).find('td');
|
||||
// This is either true or false
|
||||
var loaddev = diskArgs.eq(7).find('input').attr('checked');
|
||||
if (loaddev && iplSet) {
|
||||
errMsg = errMsg + 'You cannot have both disk IPL and zFCP LOADDEV, can only IPL one device.<br/>';
|
||||
ready = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If inputs are valid, ready to provision
|
||||
if (ready) {
|
||||
// Generate user directory entry if basic tab is selected
|
||||
@ -6641,13 +6718,13 @@ function checkProvisionCallsDone(provisionStatBar, table, finishedKey) {
|
||||
*/
|
||||
function loadzVMs(col) {
|
||||
// Get group names and description and append to group column
|
||||
if (!$.cookie('zvms')) {
|
||||
if (!$.cookie('xcat_zvms')) {
|
||||
var infoBar = createInfoBar('No selectable z/VM available');
|
||||
col.append(infoBar);
|
||||
return;
|
||||
}
|
||||
|
||||
var zNames = $.cookie('zvms').split(',');
|
||||
var zNames = $.cookie('xcat_zvms').split(',');
|
||||
|
||||
var radio, zBlock, args, zvm, hcp;
|
||||
for (var i in zNames) {
|
||||
@ -6689,13 +6766,13 @@ function loadzVMs(col) {
|
||||
*/
|
||||
function loadSrvGroups(col) {
|
||||
// Get group names and description and append to group column
|
||||
if (!$.cookie('srv_groups')) {
|
||||
if (!$.cookie('xcat_srv_groups')) {
|
||||
var infoBar = createInfoBar('No selectable group available');
|
||||
col.append(infoBar);
|
||||
return;
|
||||
}
|
||||
|
||||
var groupNames = $.cookie('srv_groups').split(',');
|
||||
var groupNames = $.cookie('xcat_srv_groups').split(',');
|
||||
|
||||
var groupBlock, radio, args, name, ip, hostname, desc;
|
||||
for (var i in groupNames) {
|
||||
@ -6739,13 +6816,13 @@ function loadSrvGroups(col) {
|
||||
*/
|
||||
function loadOSImages(col) {
|
||||
// Get group names and description and append to group column
|
||||
if (!$.cookie('srv_imagenames')) {
|
||||
if (!$.cookie('xcat_srv_imagenames')) {
|
||||
var infoBar = createInfoBar('No selectable image available');
|
||||
col.append(infoBar);
|
||||
return;
|
||||
}
|
||||
|
||||
var imgNames = $.cookie('srv_imagenames').split(',');
|
||||
var imgNames = $.cookie('xcat_srv_imagenames').split(',');
|
||||
|
||||
var imgBlock, radio, args, name, desc;
|
||||
for (var i in imgNames) {
|
||||
@ -6790,13 +6867,13 @@ function loadOSImages(col) {
|
||||
*/
|
||||
function loadGoldenImages(col) {
|
||||
// Get group names and description and append to group column
|
||||
if (!$.cookie('srv_goldenimages')) {
|
||||
if (!$.cookie('xcat_srv_goldenimages')) {
|
||||
var infoBar = createInfoBar('No selectable master copies available');
|
||||
col.append(infoBar);
|
||||
return;
|
||||
}
|
||||
|
||||
var imgNames = $.cookie('srv_goldenimages').split(',');
|
||||
var imgNames = $.cookie('xcat_srv_goldenimages').split(',');
|
||||
|
||||
var imgBlock, radio, args, name, desc;
|
||||
for (var i in imgNames) {
|
||||
@ -6844,7 +6921,7 @@ function loadGoldenImages(col) {
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
function setzVMCookies(data) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var zvms = new Array();
|
||||
var hosts = data.rsp[0].split("\n");
|
||||
for ( var i = 0; i < hosts.length; i++) {
|
||||
@ -6859,7 +6936,7 @@ function setzVMCookies(data) {
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
|
||||
$.cookie('zvms', zvms, { expires: exDate });
|
||||
$.cookie('xcat_zvms', zvms, { expires: exDate, path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -6869,7 +6946,7 @@ function setzVMCookies(data) {
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
function setGoldenImagesCookies(data) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var copies = new Array();
|
||||
var tmp = data.rsp[0].split(",");
|
||||
for ( var i = 0; i < tmp.length; i++) {
|
||||
@ -6881,7 +6958,7 @@ function setGoldenImagesCookies(data) {
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
|
||||
$.cookie('srv_goldenimages', copies, { expires: exDate });
|
||||
$.cookie('xcat_srv_goldenimages', copies, { expires: exDate, path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -6891,7 +6968,7 @@ function setGoldenImagesCookies(data) {
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
function setDiskPoolCookies(data) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var node = data.msg;
|
||||
var pools = data.rsp[0].split(node + ": ");
|
||||
var pools2 = [];
|
||||
@ -6904,7 +6981,7 @@ function setDiskPoolCookies(data) {
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
|
||||
$.cookie(node + 'diskpools', pools2, { expires: exDate });
|
||||
$.cookie('xcat_' + node + 'diskpools', pools2, { expires: exDate, path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -6914,7 +6991,7 @@ function setDiskPoolCookies(data) {
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
function setZfcpPoolCookies(data) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var node = data.msg;
|
||||
var pools = data.rsp[0].split(node + ': ');
|
||||
var pools2 = [];
|
||||
@ -6927,7 +7004,7 @@ function setZfcpPoolCookies(data) {
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
|
||||
$.cookie(node + 'zfcppools', pools2, { expires: exDate });
|
||||
$.cookie('xcat_' + node + 'zfcppools', pools2, { expires: exDate, path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -6941,7 +7018,7 @@ function setzHcpCookies(zhcps) {
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
|
||||
$.cookie('zhcps', zhcps, { expires: exDate });
|
||||
$.cookie('xcat_zhcps', zhcps, { expires: exDate, path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -6951,7 +7028,7 @@ function setzHcpCookies(zhcps) {
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
function setUserProfilesCookies(data) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var node = data.msg;
|
||||
var profiles = data.rsp[0].split(node + ': ');
|
||||
var profiles2 = [];
|
||||
@ -6964,7 +7041,7 @@ function setUserProfilesCookies(data) {
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
|
||||
$.cookie(node + 'userprofiles', profiles2, { expires: exDate });
|
||||
$.cookie('xcat_' + node + 'userprofiles', profiles2, { expires: exDate, path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -7025,7 +7102,7 @@ function configProfilePanel(panelId) {
|
||||
table.init(['<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">', 'Profile', 'Disk pool', 'Disk size', 'Directory entry']);
|
||||
|
||||
// Insert profiles into table
|
||||
var profiles = $.cookie('profiles').split(',');
|
||||
var profiles = $.cookie('xcat_profiles').split(',');
|
||||
profiles.push('default'); // Add default profile
|
||||
for (var i in profiles) {
|
||||
if (profiles[i]) {
|
||||
@ -7245,7 +7322,7 @@ function profileDialog() {
|
||||
|
||||
// Insert profiles into select
|
||||
var profileSelect = $('<select name="profile" title="The image profile to set defaults for"></select>');
|
||||
var profiles = $.cookie('profiles').split(',');
|
||||
var profiles = $.cookie('xcat_profiles').split(',');
|
||||
profiles.push('default'); // Add default profile
|
||||
for (var i in profiles) {
|
||||
if (profiles[i]) {
|
||||
@ -7420,7 +7497,7 @@ function editProfileDialog(profile, pool, size, entry) {
|
||||
|
||||
// Insert profiles into select
|
||||
var profileSelect = $('<select name="profile" title="The image profile to set defaults for"></select>');
|
||||
var profiles = $.cookie('profiles').split(',');
|
||||
var profiles = $.cookie('xcat_profiles').split(',');
|
||||
profiles.push('default'); // Add default profile
|
||||
for (var i in profiles) {
|
||||
if (profiles[i]) {
|
||||
@ -7541,7 +7618,7 @@ function editProfileDialog(profile, pool, size, entry) {
|
||||
*/
|
||||
function getHcpZvmHash() {
|
||||
// Get zVM host names
|
||||
if (!$.cookie('zvms')) {
|
||||
if (!$.cookie('xcat_zvms')) {
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -7559,7 +7636,7 @@ function getHcpZvmHash() {
|
||||
});
|
||||
}
|
||||
|
||||
var zvms = $.cookie('zvms').split(',');
|
||||
var zvms = $.cookie('xcat_zvms').split(',');
|
||||
var hcp2zvm = new Object();
|
||||
var args, zvm, iHcp, tmp;
|
||||
for (var i in zvms) {
|
||||
@ -7656,6 +7733,20 @@ function updateUserEntry(tabId) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if zFCP loaddev checked, if so ipl the fcp card
|
||||
var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr');
|
||||
if (zfcpRows.length > 0) {
|
||||
for ( var i = 0; i < zfcpRows.length; i++) {
|
||||
var diskArgs = zfcpRows.eq(i).find('td');
|
||||
var address = diskArgs.eq(1).find('input').val();
|
||||
// This is either true or false
|
||||
var loaddev = diskArgs.eq(7).find('input').attr('checked');
|
||||
if (loaddev) {
|
||||
ipl = address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only update directory entry if the basic tab is selected
|
||||
var inst = tabId.replace('zvmProvisionTab', '');
|
||||
var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected');
|
||||
@ -7699,6 +7790,20 @@ function updateUserEntry(tabId) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if zFCP loaddev checked, if so ipl the fcp card
|
||||
var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr');
|
||||
if (zfcpRows.length > 0) {
|
||||
for ( var i = 0; i < zfcpRows.length; i++) {
|
||||
var diskArgs = zfcpRows.eq(i).find('td');
|
||||
var address = diskArgs.eq(1).find('input').val();
|
||||
// This is either true or false
|
||||
var loaddev = diskArgs.eq(7).find('input').attr('checked');
|
||||
if (loaddev) {
|
||||
ipl = address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only update directory entry if the basic tab is selected
|
||||
var inst = tabId.replace('zvmProvisionTab', '');
|
||||
var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected');
|
||||
@ -7742,6 +7847,20 @@ function updateUserEntry(tabId) {
|
||||
}
|
||||
}
|
||||
|
||||
// Check if zFCP loaddev checked, if so ipl the fcp card
|
||||
var zfcpRows = $('#' + tabId + ' table:eq(1):visible tbody tr');
|
||||
if (zfcpRows.length > 0) {
|
||||
for ( var i = 0; i < zfcpRows.length; i++) {
|
||||
var diskArgs = zfcpRows.eq(i).find('td');
|
||||
var address = diskArgs.eq(1).find('input').val();
|
||||
// This is either true or false
|
||||
var loaddev = diskArgs.eq(7).find('input').attr('checked');
|
||||
if (loaddev) {
|
||||
ipl = address;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only update directory entry if the basic tab is selected
|
||||
var inst = tabId.replace('zvmProvisionTab', '');
|
||||
var hwTabIndex = $("#hwConfig" + inst).tabs('option', 'selected');
|
||||
@ -7836,6 +7955,10 @@ function generateUserEntry(userId, password, memory, privilege, profile, cpuCoun
|
||||
userDirectoryEntry += "SPOOL 000D 2540 PUNCH A\n";
|
||||
userDirectoryEntry += "SPOOL 000E 1403 A\n";
|
||||
|
||||
if (typeof console == "object"){
|
||||
console.log("Exiting generateUserEntry. Directory created:"+userDirectoryEntry);
|
||||
}
|
||||
|
||||
return userDirectoryEntry;
|
||||
}
|
||||
|
||||
@ -7936,7 +8059,7 @@ function getNetworkDetails(hcpNode, vswitchname, hashId, tabId) {
|
||||
console.log("getNetworkDetails. creating new hash[[]] table!!" + "hashindex<" + hashindex + ">" );
|
||||
}
|
||||
}
|
||||
if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || (foundInvalid == 1) ) ) {
|
||||
if (data.rsp.length && (data.rsp[0].indexOf("Failed") > -1 || (foundInvalid == 1) || data.rsp[0].indexOf("Error") > -1 ) ) {
|
||||
if (typeof console == "object") {
|
||||
console.log("getNetworkDetails. failure getting the network data for " + hcpNode + " network "+ vswitchname);
|
||||
}
|
||||
@ -7993,7 +8116,7 @@ function getNetworkDetails(hcpNode, vswitchname, hashId, tabId) {
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
function setNodeZhcpNodename(data) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1) {
|
||||
if (data.rsp.length && data.rsp[0].indexOf("Failed") == -1 && data.rsp[0].indexOf("Error") == -1) {
|
||||
var savedTokens = data.msg.split(';');
|
||||
var node = savedTokens[0];
|
||||
var hcphostname = savedTokens[1];
|
||||
@ -8010,7 +8133,7 @@ function setNodeZhcpNodename(data) {
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (60 * 60 * 1000));
|
||||
$.cookie(node+'_hcpnodename', nodename, { expires: exDate });
|
||||
$.cookie('xcat_' + node+'_hcpnodename', nodename, { expires: exDate, path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,29 @@
|
||||
/**
|
||||
* Load the help page
|
||||
* Global variables
|
||||
*/
|
||||
var helpTab; // Help tabs
|
||||
var ivpChoices = new Array;
|
||||
var ivpChoiceValues = new Array;
|
||||
var selectInfo = new Object();
|
||||
|
||||
|
||||
/**
|
||||
* Load the help page and create the tabs.
|
||||
*/
|
||||
function loadHelpPage(){
|
||||
createHelpTab();
|
||||
createVerifyXCATTab();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the Help Tab
|
||||
*
|
||||
* @return Tab object
|
||||
*/
|
||||
function createHelpTab(){
|
||||
// Create help tab
|
||||
var tab = new Tab();
|
||||
setHelpTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
|
||||
@ -28,4 +48,693 @@ function loadHelpPage(){
|
||||
'</ol>' +
|
||||
'</fieldset>');
|
||||
tab.add('helpTab', 'Help', helpForm, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create the Verify xCAT Tab
|
||||
*
|
||||
* @return Tab object
|
||||
*/
|
||||
function createVerifyXCATTab() {
|
||||
var comments = 'Description of the IVP run';
|
||||
var ivpEnabled = 'checked';
|
||||
var ivpDisabled = '';
|
||||
|
||||
// Get the tab
|
||||
var tab = getHelpTab();
|
||||
var fs, legend;
|
||||
|
||||
// Generate new tab ID
|
||||
var instance = 0;
|
||||
var newTabId = 'verifyXCATTab' + instance;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
instance = instance + 1;
|
||||
newTabId = 'verifyXCATTab' + instance;
|
||||
}
|
||||
|
||||
// Build the list of IVPs in the table
|
||||
readIvpTable();
|
||||
|
||||
// Create info bar and status bar
|
||||
var infoBar = createInfoBar( 'Run or schedule Installation Verification Procedures to verify:<br>' +
|
||||
'-xCAT MN/ZHCP Environment, or<br>' +
|
||||
'-xCAT MN/ZHCP and OpenStack Environment.' );
|
||||
|
||||
var statBarId = 'verifyXCATStatusBar' + instance;
|
||||
var statBar = createStatusBar(statBarId).hide();
|
||||
var loader = createLoader( '' );
|
||||
statBar.find('div').append( loader );
|
||||
|
||||
// Create the verify form and put info and status bars on the form.
|
||||
var verifyXCATForm = $( '<div class="form"></div>' );
|
||||
verifyXCATForm.append( infoBar, statBar );
|
||||
|
||||
// Create 'Create a Verify xCAT' fieldset
|
||||
fs = $( '<fieldset></fieldset>' );
|
||||
fs.append( $( '<legend>Verify:</legend>' ));
|
||||
fs.append( $( '<div id=divIvpId><label>ID of Run:</label>'
|
||||
+ '<select name="ivpId" onchange= "setVarsForId( this )" >'
|
||||
+ '</select>'
|
||||
+ '</div>' ));
|
||||
fs.append( $('<div><span style="font-weight:bold">Type of IVP Run:</span></div>'));
|
||||
fs.append( $('<div><input type="radio" name="runType" value="verifyBasic"/>Basic IVP: xCAT MN/ZHCP Verification</div>' ));
|
||||
fs.append( $('<div><input type="radio" name="runType" value="verifyOpenStack"/>Full IVP: xCAT MN/ZHCP and OpenStack Verification</div>' ));
|
||||
fs.append( $('<div><span style="font-weight:bold">Basic and Full IVP Parameters:</span></div>'));
|
||||
fs.append( $('<div><label>Orchestrator Script Parameters:</label><input type="text" size="80" id="orchParms" name="orchParms" value="" title="Orchestrator script (verifynode) override parameters."/></div>' ));
|
||||
fs.append( $('<div><label>Main IVP Script Parameters:</label><input type="text" size="80" id="mainParms" name="mainParms" value="" title="Main IVP script (zxcatIVP) override parameters."/></div>' ));
|
||||
fs.append( $('<div><span style="font-weight:bold">Full IVP Parameters:</span></div>'));
|
||||
fs.append( $('<div><label>OpenStack System IP Address:</label><input type="text" id="openstackIP" name="openstackIP" value="" title="IP address of OpenStack system"/></div>' ));
|
||||
fs.append( $('<div><label>OpenStack user:</label><input type="text" id="openstackUser" name="openstackUser" value="" title="User under which OpenStack runs (e.g. nova)"/></div>' ));
|
||||
fs.append( $('<div><label>Preparation Script Parameters:</label><input type="text" size="80" id="prepParms" name="prepParms" value="" title="Preparation script override parameters."/></div>' ));
|
||||
fs.append( $('<div><span style="font-weight:bold">Automated IVP Parameters:</span></div>'));
|
||||
fs.append( $('<div><label>Automated IVP Comments:</label><input type="text" size="80" id="comments" name="comments" value="'+comments+'" title="Comments for an automated IVP run"/></div>' ));
|
||||
fs.append( '<div>'+
|
||||
'<table style="border: 0pm none; text-align: left;">'+
|
||||
'<tr>'+
|
||||
'<td style="background-color:rgb(220,220,220)"><span style="font-weight:bold">Schedule</span></td>'+
|
||||
'<td><input type="checkbox" value="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23" name="ivpSchedule">Every hour</td>'+
|
||||
'</tr><tr>'+
|
||||
'<td><input type="checkbox" value="0" name="ivpSchedule">Midnight</td>'+
|
||||
'<td><input type="checkbox" value="1" name="ivpSchedule">1 am</td>'+
|
||||
'<td><input type="checkbox" value="2" name="ivpSchedule">2 am</td>'+
|
||||
'<td><input type="checkbox" value="3" name="ivpSchedule">3 am</td>'+
|
||||
'<td><input type="checkbox" value="4" name="ivpSchedule">4 am</td>'+
|
||||
'<td><input type="checkbox" value="5" name="ivpSchedule">5 am</td>'+
|
||||
'</tr><tr></td>'+
|
||||
'<td><input type="checkbox" value="6" name="ivpSchedule">6 am</td>'+
|
||||
'<td><input type="checkbox" value="7" name="ivpSchedule">7 am</td>'+
|
||||
'<td><input type="checkbox" value="8" name="ivpSchedule">8 am</td>'+
|
||||
'<td><input type="checkbox" value="9" name="ivpSchedule">9 am</td>'+
|
||||
'<td><input type="checkbox" value="10" name="ivpSchedule">10 am</td>'+
|
||||
'<td><input type="checkbox" value="11" name="ivpSchedule">11 am</td>'+
|
||||
'</tr><tr></td>'+
|
||||
'<td><input type="checkbox" value="12" name="ivpSchedule">Noon</td>'+
|
||||
'<td><input type="checkbox" value="13" name="ivpSchedule">1 pm</td>'+
|
||||
'<td><input type="checkbox" value="14" name="ivpSchedule">2 pm</td>'+
|
||||
'<td><input type="checkbox" value="15" name="ivpSchedule">3 pm</td>'+
|
||||
'<td><input type="checkbox" value="16" name="ivpSchedule">4 pm</td>'+
|
||||
'<td><input type="checkbox" value="17" name="ivpSchedule">5 pm</td>'+
|
||||
'</tr><tr></td>'+
|
||||
'<td><input type="checkbox" value="18" name="ivpSchedule">6 pm</td>'+
|
||||
'<td><input type="checkbox" value="19" name="ivpSchedule">7 pm</td>'+
|
||||
'<td><input type="checkbox" value="20" name="ivpSchedule">8 pm</td>'+
|
||||
'<td><input type="checkbox" value="21" name="ivpSchedule">9 pm</td>'+
|
||||
'<td><input type="checkbox" value="22" name="ivpSchedule">10 pm</td>'+
|
||||
'<td><input type="checkbox" value="23" name="ivpSchedule">11 pm</td>'+
|
||||
'</tr>'+
|
||||
'</table>'+
|
||||
'</div>');
|
||||
fs.append( $('<div>Disable or Enable the IVP Run:</div>'));
|
||||
fs.append( $('<div><input type="radio" name="disable" value="enabled"'+ivpEnabled+'/>Enabled to be run periodically</div>' ));
|
||||
fs.append( $('<div><input type="radio" name="disable" value="disabled"'+ivpDisabled+'/>Disabled from running periodically</div>' ));
|
||||
verifyXCATForm.append( fs );
|
||||
|
||||
var verifyBtn = createButton( 'Run an IVP Now' );
|
||||
verifyBtn.click(function() {
|
||||
var driveFunction = 1;
|
||||
var argList = '';
|
||||
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
var runType = $(this).parent().find('input[name="runType"]:checked').val();
|
||||
if ( runType == 'verifyBasic' ) {
|
||||
argList += '||--basicivp';
|
||||
} else if ( runType == 'verifyOpenStack' ) {
|
||||
argList += '||--fullivp';
|
||||
var openstackIP = $(this).parent().find('input[name=openstackIP]').val();
|
||||
if ( openstackIP != '' ) {
|
||||
argList += '||--openstackip ' + openstackIP;
|
||||
} else {
|
||||
// Show an information message.
|
||||
$('#' + statBarId).find('div').append(
|
||||
'You did not specify the IP address of the OpenStack system. The IVP ' +
|
||||
'will use the IP address of the system running the xCAT management node as ' +
|
||||
'the OpenStack IP address.<br>');
|
||||
}
|
||||
var openstackUser = $(this).parent().find('input[name=openstackUser]').val();
|
||||
if ( openstackUser != '' ) {
|
||||
argList += '||--openstackuser ' + hexEncode( openstackUser );
|
||||
}
|
||||
var prepParms = $(this).parent().find('input[name=prepParms]').val();
|
||||
if ( prepParms != '' ) {
|
||||
argList += '||--prepparms ' + hexEncode( prepParms );
|
||||
}
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You did not select a basic or full IVP.');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
driveFunction = 0;
|
||||
}
|
||||
var orchParms = $(this).parent().find('input[name=orchParms]').val();
|
||||
if ( orchParms != '' ) {
|
||||
argList += '||--orchparms ' + hexEncode( orchParms );
|
||||
}
|
||||
var mainParms = $(this).parent().find('input[name=mainParms]').val();
|
||||
if ( mainParms != '' ) {
|
||||
argList += '||--zxcatparms ' + hexEncode( mainParms );
|
||||
}
|
||||
argList += '||end';
|
||||
|
||||
if ( driveFunction == 1 ) {
|
||||
$('#' + statBarId).find('div').append( 'Invoking verifynode to run the IVP.<br>' );
|
||||
$('#' + statBarId).find('img').show();
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'verifynode '+ argList,
|
||||
msg : 'out=' + statBarId + ';cmd=verifynode'
|
||||
},
|
||||
success : updateStatusBar
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statBar.show();
|
||||
}
|
||||
});
|
||||
verifyXCATForm.append( verifyBtn );
|
||||
|
||||
var scheduleBtn = createButton( 'Schedule an IVP Run' );
|
||||
scheduleBtn.click(function() {
|
||||
var driveFunction = 1;
|
||||
var argList = '';
|
||||
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
var ivpId = $(this).parent().find('select[name=ivpId]').val();
|
||||
if ( ivpId != 'NEW' ) {
|
||||
argList += '||--id ' + ivpId;
|
||||
}
|
||||
var runType = $(this).parent().find('input[name="runType"]:checked').val();
|
||||
if ( runType == 'verifyBasic' ) {
|
||||
argList += '||--type basicivp';
|
||||
} else if ( runType == 'verifyOpenStack' ) {
|
||||
argList += '||--type fullivp';
|
||||
var openstackIP = $(this).parent().find('input[name=openstackIP]').val();
|
||||
if ( openstackIP != '' ) {
|
||||
argList = argList + '||--openstackip ' + openstackIP;
|
||||
} else {
|
||||
// Show an information message.
|
||||
$('#' + statBarId).find('div').append(
|
||||
'You did not specify the IP address of the OpenStack system. The IVP ' +
|
||||
'will use the IP address of the system running the xCAT management node as ' +
|
||||
'the OpenStack IP address.<br>');
|
||||
}
|
||||
var openstackUser = $(this).parent().find('input[name=openstackUser]').val();
|
||||
if ( openstackUser != '' ) {
|
||||
argList += '||--openstackuser ' + hexEncode( openstackUser );
|
||||
} else {
|
||||
argList += '||--openstackuser \'\'';
|
||||
}
|
||||
var prepParms = $(this).parent().find('input[name=prepParms]').val();
|
||||
if ( prepParms != '' ) {
|
||||
argList += '||--prepparms ' + hexEncode( prepParms );
|
||||
} else {
|
||||
argList += '||--prepparms \'\'';
|
||||
}
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You did not select a basic or full IVP.');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
driveFunction = 0;
|
||||
}
|
||||
var checkboxes = $(this).parent().find('input[name="ivpSchedule"]:checked');
|
||||
var ivpSchedule = "";
|
||||
for ( var i=0, n=checkboxes.length; i<n; i++ )
|
||||
{
|
||||
if ( checkboxes[i].checked )
|
||||
{
|
||||
ivpSchedule += " " + checkboxes[i].value;
|
||||
}
|
||||
}
|
||||
if ( ivpSchedule != '' ) {
|
||||
argList += '||--schedule \'' + ivpSchedule + '\'';
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You did select the hours to run an IVP.');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
driveFunction = 0;
|
||||
}
|
||||
var comments = $(this).parent().find('input[name=comments]').val();
|
||||
if ( comments != '' ) {
|
||||
argList += '||--comments ' + hexEncode( comments );
|
||||
} else {
|
||||
argList += '||--comments \'\'';
|
||||
}
|
||||
var disable = $(this).parent().find('input[name="disable"]:checked').val();
|
||||
if ( disable == 'disabled' ) {
|
||||
argList += '||--disable';
|
||||
} else if ( disable == 'enabled' ) {
|
||||
argList += '||--enable';
|
||||
}
|
||||
var orchParms = $(this).parent().find('input[name=orchParms]').val();
|
||||
if ( orchParms != '' ) {
|
||||
argList += '||--orchparms ' + hexEncode( orchParms );
|
||||
} else {
|
||||
argList += '||--orchparms \'\'';
|
||||
}
|
||||
var mainParms = $(this).parent().find('input[name=mainParms]').val();
|
||||
if ( mainParms != '' ) {
|
||||
argList += '||--zxcatparms ' + hexEncode( mainParms );
|
||||
} else {
|
||||
argList += '||--zxcatparms \'\'';
|
||||
}
|
||||
argList += '||end';
|
||||
|
||||
if ( driveFunction == 1 ) {
|
||||
$('#' + statBarId).find('div').append( 'Invoking verifynode to schedule the IVP.<br>' );
|
||||
$('#' + statBarId).find('img').show();
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'verifynode '+ argList,
|
||||
msg : 'out=' + statBarId + ';cmd=verifynode'
|
||||
},
|
||||
success : function(data) {
|
||||
updateStatusBar(data);
|
||||
readIvpTable();
|
||||
}
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statBar.show();
|
||||
}
|
||||
});
|
||||
verifyXCATForm.append( scheduleBtn );
|
||||
|
||||
var removeBtn = createButton( 'Remove an IVP Run' );
|
||||
removeBtn.click(function() {
|
||||
var driveFunction = 1;
|
||||
var argList = '';
|
||||
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
var ivpId = $(this).parent().find('select[name=ivpId]').val();
|
||||
if ( ivpId != 'NEW' ) {
|
||||
argList = '||--remove' + '||--id ' + ivpId + '||end';
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You did not select the ID of an existing run.');
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
driveFunction = 0;
|
||||
}
|
||||
|
||||
if ( driveFunction == 1 ) {
|
||||
$('#' + statBarId).find('div').append( 'Invoking verifynode to remove the IVP.<br>' );
|
||||
$('#' + statBarId).find('img').show();
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'verifynode '+ argList,
|
||||
msg : 'out=' + statBarId + ';cmd=verifynode'
|
||||
},
|
||||
success : function(data) {
|
||||
updateStatusBar(data);
|
||||
readIvpTable();
|
||||
}
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statBar.show();
|
||||
}
|
||||
});
|
||||
verifyXCATForm.append( removeBtn );
|
||||
|
||||
tab.add( newTabId, 'Verify xCAT', verifyXCATForm, false );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get node tab
|
||||
*
|
||||
* @return Tab object
|
||||
*/
|
||||
function getHelpTab() {
|
||||
return helpTab;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Drive the tabdump API to obtain the scheduled IVP information.
|
||||
*
|
||||
* @param None.
|
||||
*/
|
||||
function readIvpTable() {
|
||||
// Get IVP information
|
||||
if (!$.cookie('xcat_ivpinfo')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'zvmivp',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : setArrays
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decodes a printable hex string back into the javascript
|
||||
* unicode string that it represents.
|
||||
*
|
||||
* @param hexVal Printable hex string to convert
|
||||
* back into its original javascript string form.
|
||||
*/
|
||||
hexDecode = function( hexVal ){
|
||||
var result = "";
|
||||
|
||||
if ( hexVal.match("^HexEncoded:") ) {
|
||||
hexVal = hexVal.replace( 'HexEncoded:', '' );
|
||||
var hexes = hexVal.match(/.{1,4}/g) || [];
|
||||
for( var i = 0; i < hexes.length; i++ ) {
|
||||
result += String.fromCharCode( parseInt( hexes[i], 16 ) );
|
||||
}
|
||||
} else {
|
||||
result = hexVal;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Encode a string into printable hex. This avoids
|
||||
* an issues with escaping quotes or handling unicode.
|
||||
*
|
||||
* @param str String to encode into printable hex.
|
||||
*/
|
||||
function hexEncode( str ){
|
||||
var hex;
|
||||
|
||||
var result = 'HexEncoded:';
|
||||
for (var i=0; i < str.length; i++) {
|
||||
hex = str.charCodeAt(i).toString(16);
|
||||
result += ("000"+hex).slice(-4);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setup the arrays/hashes with the data from the zvmivp table
|
||||
*
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
function setArrays(data) {
|
||||
// Get response
|
||||
var rsp = data.rsp;
|
||||
|
||||
// Clear the list of IVP information.
|
||||
ivpChoices = new Array();
|
||||
ivpChoiceValues = new Array();
|
||||
selectInfo = new Object();
|
||||
|
||||
// Get column value
|
||||
var idPos = 0;
|
||||
var ipPos = 0;
|
||||
var schedulePos = 0;
|
||||
var lrPos = 0;
|
||||
var torPos = 0;
|
||||
var aUserPos = 0;
|
||||
var oParmsPos = 0;
|
||||
var pParmsPos = 0;
|
||||
var mainParmsPos = 0;
|
||||
var cmntPos = 0;
|
||||
|
||||
var colNameArray = rsp[0].substr(1).split(',');
|
||||
for ( var i in colNameArray ) {
|
||||
switch ( colNameArray[i] ) {
|
||||
case 'id':
|
||||
idPos = i;
|
||||
break;
|
||||
case 'ip':
|
||||
ipPos = i;
|
||||
break;
|
||||
case 'schedule':
|
||||
schedulePos = i;
|
||||
break;
|
||||
case 'last_run':
|
||||
lrPos = i;
|
||||
break;
|
||||
case 'type_of_run':
|
||||
typeOfRunPos = i;
|
||||
break;
|
||||
case 'access_user':
|
||||
aUserPos = i;
|
||||
break;
|
||||
case 'orch_parms':
|
||||
oParmsPos = i;
|
||||
break;
|
||||
case 'prep_parms':
|
||||
pParmsPos = i;
|
||||
break;
|
||||
case 'main_ivp_parms':
|
||||
mainParmsPos = i;
|
||||
break;
|
||||
case 'comments':
|
||||
cmntPos = i;
|
||||
break;
|
||||
case 'disable':
|
||||
disablePos = i;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get IVP information from the table data.
|
||||
for (var i = 1; i < rsp.length; i++) {
|
||||
var cols = rsp[i].split(',');
|
||||
var id = cols[idPos].replace(new RegExp('"', 'g'), '');
|
||||
var ip = cols[ipPos].replace(new RegExp('"', 'g'), '');
|
||||
var schedule = cols[schedulePos].replace(new RegExp('"', 'g'), '');
|
||||
var typeOfRun = cols[typeOfRunPos].replace(new RegExp('"', 'g'), '');
|
||||
var openstackUser = cols[aUserPos].replace(new RegExp('"', 'g'), '');
|
||||
var orchParms = cols[oParmsPos].replace(new RegExp('"', 'g'), '');
|
||||
var prepParms = cols[pParmsPos].replace(new RegExp('"', 'g'), '');
|
||||
var mainParms = cols[mainParmsPos].replace(new RegExp('"', 'g'), '');
|
||||
var comments = cols[cmntPos].replace(new RegExp('"', 'g'), '');
|
||||
var disable = cols[disablePos].replace(new RegExp('"', 'g'), '');
|
||||
|
||||
ivpChoiceValues.push( id );
|
||||
selectInfo[id] = new Object();
|
||||
selectInfo[id]['id'] = id;
|
||||
selectInfo[id]['ip'] = ip;
|
||||
selectInfo[id]['schedule'] = schedule;
|
||||
selectInfo[id]['typeOfRun'] = typeOfRun.toLowerCase();
|
||||
selectInfo[id]['openstackUser'] = hexDecode( openstackUser );
|
||||
selectInfo[id]['orchParms'] = hexDecode( orchParms );
|
||||
selectInfo[id]['prepParms'] = hexDecode( prepParms );
|
||||
selectInfo[id]['mainParms'] = hexDecode( mainParms );
|
||||
selectInfo[id]['comments'] = hexDecode(comments);
|
||||
selectInfo[id]['disable'] = disable.toLowerCase();
|
||||
}
|
||||
|
||||
// Sort the choices so we get a pretty list and build the choice strings.
|
||||
ivpChoiceValues.sort( function(a, b) {
|
||||
if ( ! isNaN(a) && ! isNaN(b) ) {
|
||||
// Both are numbers, do a numeric compare
|
||||
return a-b;
|
||||
} else if ( isNaN(a) && isNaN(b) ) {
|
||||
// Both are strings, do a string compare
|
||||
return a.localeCompare( b );
|
||||
} else if ( isNaN(a) ) {
|
||||
// Strings go after numbers
|
||||
return 1;
|
||||
} else {
|
||||
// Numbers go before strings
|
||||
return -1;
|
||||
}
|
||||
} );
|
||||
ivpChoiceValues.forEach( function( id ) {
|
||||
var idComments;
|
||||
if ( selectInfo[id]['comments'] != '' ) {
|
||||
idComments = id + ': ' + selectInfo[id]['comments'];
|
||||
} else {
|
||||
idComments = id + ': A comment was not specified.';
|
||||
}
|
||||
ivpChoices.push( idComments );
|
||||
}, this);
|
||||
|
||||
// Clear out a hash element for the 'NEW' choice.
|
||||
selectInfo['NEW'] = new Object();
|
||||
selectInfo['NEW']['id'] = '';
|
||||
selectInfo['NEW']['ip'] = '';
|
||||
selectInfo['NEW']['schedule'] = '';
|
||||
selectInfo['NEW']['typeOfRun'] = '';
|
||||
selectInfo['NEW']['openstackUser'] = '';
|
||||
selectInfo['NEW']['orchParms'] = '';
|
||||
selectInfo['NEW']['prepParms'] = '';
|
||||
selectInfo['NEW']['mainParms'] = '';
|
||||
selectInfo['NEW']['comments'] = '';
|
||||
selectInfo['NEW']['disable'] = '';
|
||||
|
||||
// Add in the NEW option at the top of the array.
|
||||
ivpChoices.unshift( "NEW: New IVP" );
|
||||
ivpChoiceValues.unshift( "NEW" );
|
||||
|
||||
// Construct the new Select option choices
|
||||
var ivpChoicesLen = ivpChoices.length;
|
||||
var selectIdOptions = '';
|
||||
for ( var i = 0; i < ivpChoicesLen; i++ ) {
|
||||
selectIdOptions += '<option value="' + ivpChoiceValues[i] + '">' + ivpChoices[i] + '</option>';
|
||||
}
|
||||
|
||||
// Find the division containing the select and replace its contents
|
||||
var thisTabId = $(this).parents('.tab').attr('id');
|
||||
var thisIvpSelect = $( '#' + thisTabId + ' select[name=ivpId]' );
|
||||
thisIvpSelect.children().remove();
|
||||
thisIvpSelect.append( selectIdOptions );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set node tab
|
||||
*
|
||||
* @param tab
|
||||
* Tab object
|
||||
* @return Nothing
|
||||
*/
|
||||
function setHelpTab(tab) {
|
||||
helpTab = tab;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set IVP variables based on the chosen Id
|
||||
*
|
||||
* @param data Data from HTTP request
|
||||
*/
|
||||
function setVarsForId( selected ) {
|
||||
var id = selected.value;
|
||||
|
||||
// Change the form fields based on the selected ID.
|
||||
var thisTabId = $(this).parents('.tab').attr('id');
|
||||
|
||||
var thisField = $( '#' + thisTabId + ' input[name="runType"]' );
|
||||
if ( selectInfo[id]['typeOfRun'] == 'basicivp' ) {
|
||||
thisField.val(['verifyBasic']);
|
||||
} else if ( selectInfo[id]['typeOfRun'] == 'fullivp' ) {
|
||||
thisField.val(['verifyOpenStack']);
|
||||
} else {
|
||||
var warn = createWarnBar('IVP with the id of '+id+' has an unrecognized type of run value: '+selectInfo[id]['typeOfRun']);
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
|
||||
thisField = $( '#' + thisTabId + ' input[name=orchParms]' );
|
||||
thisField.val( selectInfo[id]['orchParms'] );
|
||||
|
||||
thisField = $( '#' + thisTabId + ' input[name=prepParms]' );
|
||||
thisField.val( selectInfo[id]['prepParms'] );
|
||||
|
||||
var thisfield = $( '#' + thisTabId + ' input[name=mainParms]' );
|
||||
thisfield.val( selectInfo[id]['mainParms'] );
|
||||
|
||||
thisField = $( '#' + thisTabId + ' input[name=openstackIP]' );
|
||||
thisField.val( selectInfo[id]['ip'] );
|
||||
|
||||
thisField = $( '#' + thisTabId + ' input[name=openstackUser]' );
|
||||
thisField.val( selectInfo[id]['openstackUser'] );
|
||||
|
||||
var hours = new Object();
|
||||
var fullDay = 1;
|
||||
var hour = selectInfo[id]['schedule'].split(' ');
|
||||
for ( var j = 0; j < hour.length; j++ ) {
|
||||
hours[hour[j]] = 1;
|
||||
}
|
||||
|
||||
for (var i = 0; i <= 23; i++) {
|
||||
thisField = $( '#' + thisTabId + ' input[name=ivpSchedule][value='+i+']' );
|
||||
if ( hours[i] == 1 ) {
|
||||
thisField.attr( 'checked', true );
|
||||
} else {
|
||||
fullDay = 0;
|
||||
thisField.attr( 'checked', false );
|
||||
}
|
||||
}
|
||||
if ( fullDay == 1 ) {
|
||||
thisField = $( '#' + thisTabId + ' input[name=ivpSchedule][value=Every hour]' );
|
||||
thisField.attr( 'checked', true );
|
||||
for (var i = 0; i <= 23; i++) {
|
||||
thisField = $( '#' + thisTabId + ' input[name=ivpSchedule][value='+i+']' );
|
||||
thisField.attr( 'checked', false );
|
||||
}
|
||||
}
|
||||
|
||||
thisField = $( '#' + thisTabId + ' input[name=comments]' );
|
||||
thisField.val( selectInfo[id]['comments'] );
|
||||
|
||||
thisField = $( '#' + thisTabId + ' input[name=disable]' );
|
||||
if ( selectInfo[id]['disable'] == 1 || selectInfo[id]['disable'] == 'yes' ) {
|
||||
thisField.val(['disabled']);
|
||||
} else if ( selectInfo[id]['disable'] == '' || selectInfo[id]['disable'] == 0 ) {
|
||||
thisField.val(['enabled']);
|
||||
} else {
|
||||
var warn = createWarnBar('IVP with the id of '+id+' has an unrecognized disable value: '+selectInfo[id]['disable']);
|
||||
warn.prependTo($(this).parents('.ui-tabs-panel'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update status bar of a given tab
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateStatusBar(data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
var statBarId = '';
|
||||
var cmd = '';
|
||||
for ( var i=0; i < args.length; i++ ) {
|
||||
if ( args[i].match('^cmd=') ) {
|
||||
cmd = args[i].replace('cmd=', '');
|
||||
} else if ( args[i].match('^out=') ) {
|
||||
statBarId = args[i].replace('out=', '');
|
||||
}
|
||||
}
|
||||
|
||||
if (cmd == 'verifynode') {
|
||||
// Hide loader
|
||||
$('#' + statBarId).find('img').hide();
|
||||
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Put a check box after the response.
|
||||
var icon = $('<span class="ui-icon ui-icon-circle-check"></span>').css({
|
||||
'vertical-align': 'top'
|
||||
});
|
||||
$('#' + statBarId).find( 'div' ).append(icon);
|
||||
$('#' + statBarId).find( 'div' ).append( '<br/><br/>' );
|
||||
} else {
|
||||
// Hide loader
|
||||
$('#' + statBarId).find('img').hide();
|
||||
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ var gridData;
|
||||
// Save nodes path, used for getting detail from rrd file
|
||||
var nodePath = new Object();
|
||||
|
||||
// Save nodes current status,
|
||||
// unknown = -2, error = -1, warning = 0, normal = 1 are used for sorting
|
||||
// Save nodes current status,
|
||||
// unknown = -2, error = -1, warning = 0, normal = 1 are used for sorting
|
||||
var nodeStatus = new Object();
|
||||
|
||||
// Update timer
|
||||
@ -28,14 +28,14 @@ var otherhash;
|
||||
|
||||
/**
|
||||
* Load Ganglia monitoring tool
|
||||
*
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function loadGangliaMon() {
|
||||
$('#gangliamon').append(createInfoBar('Checking RPMs'));
|
||||
|
||||
|
||||
// Get groups and set cookie
|
||||
if (!$.cookie('groups')) {
|
||||
if (!$.cookie('xcat_groups')) {
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -49,7 +49,7 @@ function loadGangliaMon() {
|
||||
success : setGroupsCookies
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Check whether Ganglia RPMs are installed on the xCAT MN
|
||||
$.ajax({
|
||||
url : 'lib/systemcmd.php',
|
||||
@ -65,13 +65,13 @@ function loadGangliaMon() {
|
||||
|
||||
/**
|
||||
* Check whether Ganglia RPMs are installed
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function checkGangliaRPMs(data) {
|
||||
var gangliaTab = $('#gangliamon');
|
||||
gangliaTab.empty();
|
||||
|
||||
|
||||
// Get the list of Ganglia RPMs installed
|
||||
var status = data.rsp.split(/\n/);
|
||||
var gangliaRPMs = ["rrdtool", "ganglia-gmetad", "ganglia-gmond"];
|
||||
@ -91,7 +91,7 @@ function checkGangliaRPMs(data) {
|
||||
warningBar.prependTo(gangliaTab);
|
||||
} else {
|
||||
gangliaTab.append(createInfoBar('Checking running status'));
|
||||
|
||||
|
||||
// Check if ganglia is running on the xCAT MN
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
@ -106,19 +106,19 @@ function checkGangliaRPMs(data) {
|
||||
success : checkGangliaRunning
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether Ganglia is running
|
||||
*
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function checkGangliaRunning(data) {
|
||||
var gangliaTab = $('#gangliamon');
|
||||
gangliaTab.empty();
|
||||
|
||||
|
||||
// If Ganglia is not started
|
||||
if (data.rsp[0].indexOf("not-monitored") > -1) {
|
||||
// Create link to start Ganglia
|
||||
@ -151,13 +151,13 @@ function checkGangliaRunning(data) {
|
||||
|
||||
// If there are any warning messages, append this warning after it
|
||||
var curWarnings = $('#gangliamon').find('.ui-state-error');
|
||||
|
||||
|
||||
if (curWarnings.length) {
|
||||
curWarnings.after(warningBar);
|
||||
} else {
|
||||
warningBar.prependTo(gangliaTab);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ function checkGangliaRunning(data) {
|
||||
'<td style="background:#FF3030;width:16px;padding:0px;"> </td><td style="padding:0px;">Error</td>' +
|
||||
'<td style="background:#8B8B7A;width:16px;padding:0px;"> </td><td style="padding:0px;">Unknown</td>' +
|
||||
'</tr></table>';
|
||||
|
||||
|
||||
// Gganglia grid overview
|
||||
var showStr = '<div><h3 style="display:inline;">Grid Overview</h3>' +
|
||||
'<sup id="hidesup" style="cursor: pointer;color:blue;float:right">[Hide]</sup></div><hr>' +
|
||||
@ -181,11 +181,11 @@ function checkGangliaRunning(data) {
|
||||
// Get summary data and draw on page
|
||||
$('#gangliaGridSummary').append('Getting grid summary data <img src="images/loader.gif"></img>');
|
||||
sendGridSummaryAjax();
|
||||
|
||||
|
||||
// Get all nodes location data which can support the zoom monitor
|
||||
$('#gangliaNodes').append('Getting all nodes status <img src="images/loader.gif"></img>');
|
||||
sendLocationAjax();
|
||||
|
||||
|
||||
// Bind the hide/show button event
|
||||
$('#gangliamon #hidesup').bind('click', function(){
|
||||
if ('[Hide]' == $(this).text()) {
|
||||
@ -193,7 +193,7 @@ function checkGangliaRunning(data) {
|
||||
} else {
|
||||
$(this).html('[Hide]');
|
||||
}
|
||||
|
||||
|
||||
$('#gangliaGridSummary').toggle();
|
||||
});
|
||||
}
|
||||
@ -211,16 +211,16 @@ function sendLocationAjax() {
|
||||
args : 'graph',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
|
||||
success: function(data){
|
||||
if (!data.rsp[0]) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
extractLocationlData(data.rsp[0]);
|
||||
// Get nodes current status and draw on the page
|
||||
sendNodeCurrentAjax();
|
||||
|
||||
|
||||
// Start the timer to update page per minute
|
||||
gangliaTimer = window.setTimeout('updateGangliaPage()', 60000);
|
||||
}
|
||||
@ -235,14 +235,14 @@ function extractLocationlData(locationData) {
|
||||
cechash = new Object();
|
||||
bladehash = new Object();
|
||||
rackhash = new Object();
|
||||
|
||||
|
||||
// Linux nodes which has no parent
|
||||
linuxArray = new Array();
|
||||
|
||||
|
||||
// Other unknown nodes only have one parent, use number 1 as there parent
|
||||
otherhash = new Object();
|
||||
otherhash[1] = new Array();
|
||||
|
||||
|
||||
var allnodearray = locationData.split(';');
|
||||
var temparray;
|
||||
var parent = '';
|
||||
@ -250,7 +250,7 @@ function extractLocationlData(locationData) {
|
||||
for (var i in allnodearray) {
|
||||
temparray = allnodearray[i].split(':');
|
||||
name = temparray[0];
|
||||
|
||||
|
||||
// If there is not parent (or mpa, or rack) information
|
||||
parent = temparray[2];
|
||||
if (!parent) {
|
||||
@ -258,26 +258,26 @@ function extractLocationlData(locationData) {
|
||||
otherhash[1].push(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
switch (temparray[1].toLowerCase()) {
|
||||
case 'blade': {
|
||||
if (!bladehash[parent]) {
|
||||
bladehash[parent] = new Array();
|
||||
}
|
||||
|
||||
|
||||
bladehash[parent].push(name);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'systemx': {
|
||||
if (!rackhash[parent]) {
|
||||
rackhash[parent] = new Array();
|
||||
}
|
||||
|
||||
|
||||
rackhash[parent].push(name);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'frame': {
|
||||
if (!framehash[name]) {
|
||||
framehash[name] = new Array();
|
||||
@ -289,21 +289,21 @@ function extractLocationlData(locationData) {
|
||||
if (!framehash[parent]) {
|
||||
framehash[parent] = new Array();
|
||||
}
|
||||
|
||||
|
||||
framehash[parent].push(name);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'lpar':
|
||||
case 'lpar,osi':
|
||||
case 'osi,lpar': {
|
||||
if (!cechash[parent]) {
|
||||
cechash[parent] = new Array();
|
||||
}
|
||||
|
||||
|
||||
cechash[parent].push(name);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
default: {
|
||||
otherhash[1].push(name);
|
||||
@ -327,7 +327,7 @@ function sendGridSummaryAjax() {
|
||||
args : 'gangliashow;_grid_;hour;_summary_',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
|
||||
success: function(data) {
|
||||
createGridSummaryData(data.rsp[0]);
|
||||
drawGridSummary();
|
||||
@ -339,7 +339,7 @@ function sendGridSummaryAjax() {
|
||||
* Send AJAX request to get nodes current load information
|
||||
*/
|
||||
function sendNodeCurrentAjax() {
|
||||
|
||||
|
||||
// Get all nodes current status
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@ -350,7 +350,7 @@ function sendNodeCurrentAjax() {
|
||||
args : 'gangliacurrent;node;',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
|
||||
success: function(data){
|
||||
createNodeStatusData(data.rsp[0]);
|
||||
drawGangliaNodesArea($('#gangliaorder').val());
|
||||
@ -372,7 +372,7 @@ function sendGridCurrentAjax(){
|
||||
args : 'gangliacurrent;grid',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
|
||||
success: function(data){
|
||||
updateGridSummaryData(data.rsp[0]);
|
||||
drawGridSummary();
|
||||
@ -381,13 +381,13 @@ function sendGridCurrentAjax(){
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the grid summary data to local global variable
|
||||
* Save the grid summary data to local global variable
|
||||
*/
|
||||
function createGridSummaryData(summaryString){
|
||||
// Empty the global data
|
||||
// The data structure looks like: metric1:time11,val11,time12,val12,...;metric2:time21,val21,time22,val22,...;....
|
||||
gridData = new Object();
|
||||
|
||||
|
||||
var metricArray = summaryString.split(';');
|
||||
var metricname = '';
|
||||
var valueArray = '';
|
||||
@ -395,13 +395,13 @@ function createGridSummaryData(summaryString){
|
||||
var tempLength = 0;
|
||||
for (var index = 0; index < metricArray.length; index++) {
|
||||
position = metricArray[index].indexOf(':');
|
||||
|
||||
|
||||
// Get the metric name and init its global array to save timestamp and value pair
|
||||
metricname = metricArray[index].substr(0, position);
|
||||
gridData[metricname] = new Array();
|
||||
valueArray = metricArray[index].substr(position + 1).split(',');
|
||||
tempLength = valueArray.length;
|
||||
|
||||
|
||||
// Save timestamp and value into global array
|
||||
for (var i = 0; i < tempLength; i++) {
|
||||
gridData[metricname].push(Number(valueArray[i]));
|
||||
@ -420,7 +420,7 @@ function updateGridSummaryData(currentString){
|
||||
var tempLength = 0;
|
||||
var index = 0;
|
||||
var tempArray;
|
||||
|
||||
|
||||
tempLength = metricArray.length;
|
||||
for (index = 0; index < tempLength; index++) {
|
||||
position = metricArray[index].indexOf(':');
|
||||
@ -442,19 +442,19 @@ function drawGridSummary() {
|
||||
var gridDrawArea = $('#gangliaGridSummary');
|
||||
var showStr = '';
|
||||
var tempStr = $('#gangliamon').attr('class');
|
||||
|
||||
|
||||
// jqflot only draws on the visible area
|
||||
// If the tab is hide, return directly
|
||||
if (tempStr.indexOf('hide') != -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ($('#gangliamon #hidesup').text() == '[Show]') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
gridDrawArea.empty();
|
||||
showStr = '<table style="border-style:none;"><tr><td style="padding:0;border-style:none;"><div id="gangliasummaryload" class="monitor-sum-div"></div></td>' +
|
||||
showStr = '<table style="border-style:none;"><tr><td style="padding:0;border-style:none;"><div id="gangliasummaryload" class="monitor-sum-div"></div></td>' +
|
||||
'<td style="padding:0;border-style:none;"><div id="gangliasummarycpu" class="monitor-sum-div"></div></td>' +
|
||||
'<td style="padding:0;border-style:none;"><div id="gangliasummarymem" class="monitor-sum-div"></div></td></tr>' +
|
||||
'<tr><td style="padding:0;border-style:none;"><div id="gangliasummarydisk" class="monitor-sum-div"></div></td>' +
|
||||
@ -470,7 +470,7 @@ function drawGridSummary() {
|
||||
|
||||
/**
|
||||
* Draw the load flot by data (summary data or one node data)
|
||||
*
|
||||
*
|
||||
* @param areaid Which DIV draw this flot
|
||||
* @param loadpair The load timestamp and value pair
|
||||
* @param cpupair The CPU number and value pair
|
||||
@ -481,7 +481,7 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) {
|
||||
var index = 0;
|
||||
var yaxismax = 0;
|
||||
var interval = 1;
|
||||
|
||||
|
||||
$('#' + areaid).empty();
|
||||
// Parse load pair, the timestamp must mutiply 1000, javascript time stamp is millisecond
|
||||
for (index = 0; index < loadpair.length; index += 2) {
|
||||
@ -490,7 +490,7 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) {
|
||||
yaxismax = loadpair[index + 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Parse cpu pair
|
||||
for (index = 0; index < cpupair.length; index += 2) {
|
||||
cpunum.push([cpupair[index] * 1000, cpupair[index + 1]]);
|
||||
@ -498,12 +498,12 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) {
|
||||
yaxismax = cpupair[index + 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
interval = parseInt(yaxismax / 3);
|
||||
if (interval < 1) {
|
||||
interval = 1;
|
||||
}
|
||||
|
||||
|
||||
$.jqplot(areaid, [load, cpunum], {
|
||||
title: titleprefix + ' Loads/Procs Last Hour',
|
||||
axes:{
|
||||
@ -531,7 +531,7 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) {
|
||||
|
||||
/**
|
||||
* Draw the CPU usage flot by data (maybe summary data or one node data)
|
||||
*
|
||||
*
|
||||
* @param areaid Which DIV draw this flot
|
||||
* @param titleprefix Title used name
|
||||
* @param cpupair The CPU timestamp and value pair
|
||||
@ -539,15 +539,15 @@ function drawLoadFlot(areaid, titleprefix, loadpair, cpupair) {
|
||||
function drawCpuFlot(areaid, titleprefix, cpupair) {
|
||||
var cpu = new Array();
|
||||
var index = 0;
|
||||
|
||||
|
||||
$('#' + areaid).empty();
|
||||
|
||||
|
||||
// Time stamp should be mutiplied by 1000
|
||||
// We get the CPU idle from server
|
||||
for (index = 0; index < cpupair.length; index +=2) {
|
||||
cpu.push([(cpupair[index] * 1000), (100 - cpupair[index + 1])]);
|
||||
}
|
||||
|
||||
|
||||
$.jqplot(areaid, [cpu],{
|
||||
title: titleprefix + ' Cpu Use Last Hour',
|
||||
axes:{
|
||||
@ -571,7 +571,7 @@ function drawCpuFlot(areaid, titleprefix, cpupair) {
|
||||
|
||||
/**
|
||||
* Draw the memory usage flot by data (summary data or one node data)
|
||||
*
|
||||
*
|
||||
* @param areaid Which DIV draw this flot
|
||||
* @param titleprefix Title used name
|
||||
* @param cpupair The CPU timestamp and value pair
|
||||
@ -581,14 +581,14 @@ function drawMemFlot(areaid, titleprefix, freepair, totalpair){
|
||||
var total = new Array();
|
||||
var tempsize = 0;
|
||||
var index = 0;
|
||||
|
||||
|
||||
$('#' + areaid).empty();
|
||||
if (freepair.length < totalpair.length) {
|
||||
tempsize = freepair.length;
|
||||
} else {
|
||||
tempsize = freepair.length;
|
||||
}
|
||||
|
||||
|
||||
for (index = 0; index < tempsize; index += 2) {
|
||||
var temptotal = totalpair[index + 1];
|
||||
var tempuse = temptotal - freepair[index + 1];
|
||||
@ -597,7 +597,7 @@ function drawMemFlot(areaid, titleprefix, freepair, totalpair){
|
||||
total.push([totalpair[index] * 1000, temptotal]);
|
||||
use.push([freepair[index] * 1000, tempuse]);
|
||||
}
|
||||
|
||||
|
||||
$.jqplot(areaid, [use, total], {
|
||||
title: titleprefix + ' Memory Use Last Hour',
|
||||
axes:{
|
||||
@ -625,7 +625,7 @@ function drawMemFlot(areaid, titleprefix, freepair, totalpair){
|
||||
|
||||
/**
|
||||
* Draw the disk usage flot by data (summary data or one node's data)
|
||||
*
|
||||
*
|
||||
* @param areaid Which div draw this flot
|
||||
* @param titleprefix Title used name
|
||||
* @param freepair The free disk number, Ganglia only logs the free data
|
||||
@ -636,21 +636,21 @@ function drawDiskFlot(areaid, titleprefix, freepair, totalpair) {
|
||||
var total = new Array();
|
||||
var tempsize = 0;
|
||||
var index = 0;
|
||||
|
||||
|
||||
$('#' + areaid).empty();
|
||||
if (freepair.length < totalpair.length) {
|
||||
tempsize = freepair.length;
|
||||
} else{
|
||||
tempsize = freepair.length;
|
||||
}
|
||||
|
||||
|
||||
for (index = 0; index < tempsize; index += 2) {
|
||||
var temptotal = totalpair[index + 1];
|
||||
var tempuse = temptotal - freepair[index + 1];
|
||||
total.push([totalpair[index] * 1000, temptotal]);
|
||||
use.push([freepair[index] * 1000, tempuse]);
|
||||
}
|
||||
|
||||
|
||||
$.jqplot(areaid, [use, total], {
|
||||
title: titleprefix + ' Disk Use Last Hour',
|
||||
axes:{
|
||||
@ -678,7 +678,7 @@ function drawDiskFlot(areaid, titleprefix, freepair, totalpair) {
|
||||
|
||||
/**
|
||||
* Draw the network load flot by data (summary data or one node data)
|
||||
*
|
||||
*
|
||||
* @param areaid Which div draw this flot
|
||||
* @param titleprefix Title used name
|
||||
* @param inpair The timestamp and value pair for download
|
||||
@ -691,19 +691,19 @@ function drawNetworkFlot(areaid, titleprefix, inpair, outpair) {
|
||||
var maxvalue = 0;
|
||||
var unitname = 'B';
|
||||
var divisor = 1;
|
||||
|
||||
|
||||
for (index = 0; index < inpair.length; index += 2) {
|
||||
if (inpair[index + 1] > maxvalue) {
|
||||
maxvalue = inpair[index + 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (index = 0; index < outpair.length; index += 2) {
|
||||
if (outpair[index + 1] > maxvalue) {
|
||||
maxvalue = outpair[index + 1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (maxvalue > 3000000) {
|
||||
divisor = 1000000;
|
||||
unitname = 'GB';
|
||||
@ -713,15 +713,15 @@ function drawNetworkFlot(areaid, titleprefix, inpair, outpair) {
|
||||
} else {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
for (index = 0; index < inpair.length; index += 2) {
|
||||
inArray.push([(inpair[index] * 1000), (inpair[index + 1] / divisor)]);
|
||||
}
|
||||
|
||||
|
||||
for (index = 0; index < outpair.length; index += 2) {
|
||||
outArray.push([(outpair[index] * 1000), (outpair[index + 1] / divisor)]);
|
||||
}
|
||||
|
||||
|
||||
$.jqplot(areaid, [inArray, outArray], {
|
||||
title: titleprefix + ' Network Last Hour',
|
||||
axes:{
|
||||
@ -749,7 +749,7 @@ function drawNetworkFlot(areaid, titleprefix, inpair, outpair) {
|
||||
|
||||
/**
|
||||
* Create node status data
|
||||
*
|
||||
*
|
||||
* @param nodesStatus Node status
|
||||
*/
|
||||
function createNodeStatusData(nodesStatus) {
|
||||
@ -759,15 +759,15 @@ function createNodeStatusData(nodesStatus) {
|
||||
var index = 0;
|
||||
var tempArray;
|
||||
var tempStr = '';
|
||||
|
||||
|
||||
for (index in nodePath) {
|
||||
delete(nodePath[index]);
|
||||
}
|
||||
|
||||
|
||||
for (index in nodeStatus) {
|
||||
delete(nodeStatus[index]);
|
||||
}
|
||||
|
||||
|
||||
for (index = 0; index < nodesArray.length; index++) {
|
||||
tempStr = nodesArray[index];
|
||||
position = tempStr.indexOf(':');
|
||||
@ -785,18 +785,18 @@ function createNodeStatusData(nodesStatus) {
|
||||
*/
|
||||
function drawGangliaNodesArea() {
|
||||
var position = 0;
|
||||
|
||||
|
||||
// Find out the last child's type and name
|
||||
var currentobj = $('#zoomDiv span:last');
|
||||
var type = currentobj.attr('name').toLowerCase();
|
||||
var name = currentobj.text();
|
||||
position = name.indexOf('(');
|
||||
|
||||
|
||||
if (position > -1) {
|
||||
name = name.substr(3, position - 3);
|
||||
}
|
||||
$('#gangliaNodes').empty();
|
||||
|
||||
|
||||
switch (type) {
|
||||
// Draw the node current status
|
||||
case 'blade':
|
||||
@ -806,7 +806,7 @@ function drawGangliaNodesArea() {
|
||||
drawGangliaNodesAreaPic(type, name);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
// Draw a summary table
|
||||
case 'all':
|
||||
case 'frame': {
|
||||
@ -825,7 +825,7 @@ function drawGangliaNodesAreaPic(type, name) {
|
||||
var showStr = '';
|
||||
var nodename = '';
|
||||
var temparray;
|
||||
|
||||
|
||||
switch(type) {
|
||||
case 'blade': {
|
||||
arraypoint = bladehash[name];
|
||||
@ -846,10 +846,10 @@ function drawGangliaNodesAreaPic(type, name) {
|
||||
break;
|
||||
}
|
||||
$('#gangliaNodes').html('<ul style="margin:0px;padding:0px;"></ul>');
|
||||
|
||||
|
||||
temparray = arraypoint.sort();
|
||||
templength = arraypoint.length;
|
||||
|
||||
|
||||
for (index = 0; index < templength; index++) {
|
||||
nodename = temparray[index];
|
||||
switch (nodeStatus[nodename]) {
|
||||
@ -868,7 +868,7 @@ function drawGangliaNodesAreaPic(type, name) {
|
||||
}
|
||||
$('#gangliaNodes ul').append(showStr);
|
||||
}
|
||||
|
||||
|
||||
// Bind all normal and warning nodes click event
|
||||
$('.monitor-normal,.monitorwarning').bind('click', function() {
|
||||
var nodename = $(this).attr('title');
|
||||
@ -881,45 +881,45 @@ function drawGangliaNodesAreaTable(type, name) {
|
||||
var table = $('<table></table>');
|
||||
var row = '';
|
||||
var usedCec = new Object();
|
||||
|
||||
|
||||
var header = $('<thead class="ui-widget-header"> <th>Name</th><th>Type</th><th>Normal</th><th>Heavy Load</th><th>Error</th><th>Unknown</th> </thead>');
|
||||
table.append(header);
|
||||
|
||||
|
||||
if (type == 'all') {
|
||||
for (var i in framehash) {
|
||||
var framename = i;
|
||||
row = '<tr><td><a href="#" onclick="addZoomDiv(this)" name="frame">' + framename + '</a></td><td>Frame</td>' +
|
||||
row = '<tr><td><a href="#" onclick="addZoomDiv(this)" name="frame">' + framename + '</a></td><td>Frame</td>' +
|
||||
monitorStatAgg('frame', framehash[i]) + '</tr>';
|
||||
table.append(row);
|
||||
for(var j in framehash[i]){
|
||||
usedCec[framehash[i][j]] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (var i in cechash) {
|
||||
if (usedCec[i]) {
|
||||
continue;
|
||||
}
|
||||
var cecname = i;
|
||||
row = '<tr><td><a href="#" onclick="addZoomDiv(this)" name="cec">' + cecname + '</a></td><td>CEC</td>' +
|
||||
row = '<tr><td><a href="#" onclick="addZoomDiv(this)" name="cec">' + cecname + '</a></td><td>CEC</td>' +
|
||||
monitorStatAgg('cec', cechash[i]) + '</tr>';
|
||||
table.append(row);
|
||||
}
|
||||
|
||||
|
||||
for (var i in bladehash) {
|
||||
var bladename = i;
|
||||
row = '<tr><td><a href="#" onclick="addZoomDiv(this)" name="blade">' + bladename + '</a></td><td>Blade</td>' +
|
||||
row = '<tr><td><a href="#" onclick="addZoomDiv(this)" name="blade">' + bladename + '</a></td><td>Blade</td>' +
|
||||
monitorStatAgg('blade', bladehash[i]) + '</tr>';
|
||||
table.append(row);
|
||||
}
|
||||
|
||||
|
||||
for (var i in rackhash) {
|
||||
var rackname = i;
|
||||
row = '<tr><td><a href="#" onclick="addZoomDiv(this)" name="rack">' + rackname + '</a></td><td>Rack</td>' +
|
||||
monitorStatAgg('rack', rackhash[i]) + '</tr>';
|
||||
table.append(row);
|
||||
}
|
||||
|
||||
|
||||
if (otherhash[1].length > 0) {
|
||||
row = '<tr><td><a href="#" onclick="addZoomDiv(this)" name="other">Other</a></td><td>Other</td>' +
|
||||
monitorStatAgg('other', otherhash[1]) + '</tr>';
|
||||
@ -933,7 +933,7 @@ function drawGangliaNodesAreaTable(type, name) {
|
||||
table.append(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$('#gangliaNodes').append(table);
|
||||
}
|
||||
|
||||
@ -947,7 +947,7 @@ function monitorStatAgg(type, inputarray) {
|
||||
var nuknownnum = 0;
|
||||
var tempArray;
|
||||
var tempname;
|
||||
|
||||
|
||||
switch (type) {
|
||||
case 'blade':
|
||||
case 'cec':
|
||||
@ -970,7 +970,7 @@ function monitorStatAgg(type, inputarray) {
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
for (var i in tempArray) {
|
||||
tempname = tempArray[i];
|
||||
switch(nodeStatus[tempname]) {
|
||||
@ -988,12 +988,12 @@ function monitorStatAgg(type, inputarray) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
normalnum = normalnum?normalnum:'-';
|
||||
warningnum = warningnum?warningnum:'-';
|
||||
errornum = errornum?errornum:'-';
|
||||
nuknownnum = nuknownnum?nuknownnum:'-';
|
||||
|
||||
|
||||
return ('<td>' + normalnum + '</td><td>' + warningnum + '</td><td>' + errornum + '</td><td>' + nuknownnum + '</td>');
|
||||
}
|
||||
|
||||
@ -1004,10 +1004,10 @@ function updateGangliaPage() {
|
||||
if ($('#gangliaNodes').size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sendGridCurrentAjax();
|
||||
sendNodeCurrentAjax();
|
||||
|
||||
|
||||
gangliaTimer = window.setTimeout('updateGangliaPage()', 60000);
|
||||
}
|
||||
|
||||
@ -1021,7 +1021,7 @@ function updateZoom(obj) {
|
||||
}
|
||||
$(obj).removeClass('monitor-zoom-link');
|
||||
$(obj).unbind('click');
|
||||
|
||||
|
||||
drawGangliaNodesArea();
|
||||
}
|
||||
|
||||
@ -1031,16 +1031,16 @@ function updateZoom(obj) {
|
||||
function addZoomDiv(obj) {
|
||||
var name = $(obj).text();
|
||||
var type = $(obj).attr('name');
|
||||
|
||||
|
||||
var lastzoomobj = $('#zoomDiv span:last');
|
||||
lastzoomobj.addClass('monitor-zoom-link');
|
||||
lastzoomobj.bind('click', function() {
|
||||
updateZoom(this);
|
||||
});
|
||||
|
||||
|
||||
var newcontent = ' > ' + name + '(' + type.toUpperCase() + ')';
|
||||
var newli = '<span name="' + type + '">' + newcontent + '</span>';
|
||||
$('#zoomDiv').append(newli);
|
||||
|
||||
|
||||
drawGangliaNodesArea();
|
||||
}
|
@ -97,7 +97,7 @@ function loadNodesPage() {
|
||||
success : function(data){
|
||||
loadGroups(data);
|
||||
|
||||
var cookieGroup = $.cookie('selectgrouponnodes');
|
||||
var cookieGroup = $.cookie('xcat_selectgrouponnodes');
|
||||
if (cookieGroup) {
|
||||
$('#groups .groupdiv div').each(function(){
|
||||
if ($(this).text() == cookieGroup){
|
||||
@ -231,7 +231,7 @@ function loadGroups(data) {
|
||||
$(this).addClass('selectgroup');
|
||||
|
||||
// Save selected group into cookie
|
||||
$.cookie('selectgrouponnodes', thisGroup, { expires: 7 });
|
||||
$.cookie('xcat_selectgrouponnodes', thisGroup, { expires: 7, path: '/xcat', secure:true });
|
||||
|
||||
drawNodesArea(thisGroup,'',thisGroup);
|
||||
});
|
||||
@ -347,8 +347,8 @@ function drawNodesArea(targetgroup, cmdargs, message){
|
||||
|
||||
// Get last view (if any)
|
||||
// This can be summary, nodes, or graphic
|
||||
if ($.cookie('tabindex_history')) {
|
||||
var order = $.cookie('tabindex_history').split(',');
|
||||
if ($.cookie('xcat_tabindex_history')) {
|
||||
var order = $.cookie('xcat_tabindex_history').split(',');
|
||||
order[0] = parseInt(order[0]);
|
||||
order[1] = parseInt(order[1]);
|
||||
if (order[0] == 0 || order[1] == 0) {
|
||||
@ -1095,7 +1095,7 @@ function loadNodes(data) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
|
||||
var zhcpsCheck = $.cookie('zhcps').split(',');
|
||||
var zhcpsCheck = $.cookie('xcat_zhcps').split(',');
|
||||
var zhcpHash = new Object();
|
||||
for (var h in zhcpsCheck) {
|
||||
if (!zhcpHash[zhcpsCheck[h]]) {
|
||||
@ -1917,7 +1917,7 @@ function loadNode(e) {
|
||||
newTabId = 'nodeTab' + inst;
|
||||
}
|
||||
// Reset node process
|
||||
$.cookie(node + 'Processes', 0);
|
||||
$.cookie('xcat_' + node + 'Processes', 0, { path: '/xcat', secure:true });
|
||||
|
||||
// Add new tab, only if one does not exist
|
||||
var loader = createLoader(newTabId + 'TabLoader');
|
||||
@ -2909,28 +2909,28 @@ function setOSImageCookies(data) {
|
||||
}
|
||||
|
||||
// Save image names in a cookie
|
||||
$.cookie('imagenames', imageNames);
|
||||
$.cookie('xcat_imagenames', imageNames, { path: '/xcat', secure:true });
|
||||
|
||||
// Save profiles in a cookie
|
||||
var tmp = new Array;
|
||||
for (var key in profilesHash) {
|
||||
tmp.push(key);
|
||||
}
|
||||
$.cookie('profiles', tmp);
|
||||
$.cookie('xcat_profiles', tmp, { path: '/xcat', secure:true });
|
||||
|
||||
// Save OS versions in a cookie
|
||||
tmp = new Array;
|
||||
for (var key in osVersHash) {
|
||||
tmp.push(key);
|
||||
}
|
||||
$.cookie('osvers', tmp);
|
||||
$.cookie('xcat_osvers', tmp, { path: '/xcat', secure:true });
|
||||
|
||||
// Save OS architectures in a cookie
|
||||
tmp = new Array;
|
||||
for (var key in osArchsHash) {
|
||||
tmp.push(key);
|
||||
}
|
||||
$.cookie('osarchs', tmp);
|
||||
$.cookie('xcat_osarchs', tmp, { path: '/xcat', secure:true });
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2940,7 +2940,7 @@ function setOSImageCookies(data) {
|
||||
*/
|
||||
function setGroupsCookies(data) {
|
||||
var rsp = data.rsp;
|
||||
$.cookie('groups', rsp);
|
||||
$.cookie('xcat_groups', rsp, { path: '/xcat', secure:true });
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4202,7 +4202,7 @@ function advancedLoad(group){
|
||||
zhcpHash[args[0]] = 1;
|
||||
|
||||
// If there are no disk pools or network names cookie for this hcp
|
||||
if (!$.cookie(args[0] + 'diskpools') || !$.cookie(args[0] + 'networks')) {
|
||||
if (!$.cookie('xcat_' + args[0] + 'diskpools') || !$.cookie('xcat_' + args[0] + 'networks')) {
|
||||
// Check if SMAPI is online
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
@ -4226,7 +4226,7 @@ function advancedLoad(group){
|
||||
setzHcpCookies(shortzHcps);
|
||||
|
||||
// Retrieve z/VM hypervisors and their zHCPs
|
||||
if (!$.cookie('zvms')) {
|
||||
if (!$.cookie('xcat_zvms')) {
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
|
@ -87,7 +87,7 @@ function loadNodesetPage(tgtNodes) {
|
||||
var osSelect = $('<select name="os" title="The operating system image to be installed on this node"></select>');
|
||||
osSelect.append($('<option value=""></option>'));
|
||||
|
||||
var imageNames = $.cookie('imagenames').split(',');
|
||||
var imageNames = $.cookie('xcat_imagenames').split(',');
|
||||
if (imageNames) {
|
||||
imageNames.sort();
|
||||
for (var i in imageNames) {
|
||||
|
@ -9,7 +9,7 @@ var selectNode;
|
||||
|
||||
/**
|
||||
* Get all nodes useful attributes from remote server
|
||||
*
|
||||
*
|
||||
* @param dataTypeIndex The index in the array which contains attributes we need.
|
||||
* @param attrNullNode The target node list for this attribute
|
||||
*/
|
||||
@ -36,7 +36,7 @@ function initGraphicalData() {
|
||||
|
||||
/**
|
||||
* Extract all nodes userful data into a hash, which will be used for creating graphical
|
||||
*
|
||||
*
|
||||
* @param data The response from xCAT command 'nodels all nodetype.nodetype ppc.parent ...'
|
||||
* @return nodes list for next time query
|
||||
*/
|
||||
@ -115,7 +115,7 @@ function createPhysicalLayout(nodeList) {
|
||||
}
|
||||
|
||||
function getNodesAndDraw() {
|
||||
var groupName = $.cookie('selectgrouponnodes');
|
||||
var groupName = $.cookie('xcat_selectgrouponnodes');
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -183,64 +183,64 @@ function fillList(nodeName, defaultnodetype) {
|
||||
}
|
||||
|
||||
switch (nodeType) {
|
||||
case 'frame':
|
||||
case 'frame':
|
||||
if (undefined == bpaList[nodeName]) {
|
||||
bpaList[nodeName] = new Array();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'lpar,osi':
|
||||
case 'lpar':
|
||||
case 'osi':
|
||||
case 'osi':
|
||||
if ('' == parentName) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (undefined == fspList[parentName]) {
|
||||
fillList(parentName, 'cec');
|
||||
}
|
||||
|
||||
|
||||
fspList[parentName]['children'].push(nodeName);
|
||||
lparList[nodeName] = status;
|
||||
|
||||
|
||||
break;
|
||||
case 'cec':
|
||||
case 'cec':
|
||||
if (undefined != fspList[nodeName]) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
fspList[nodeName] = new Object();
|
||||
fspList[nodeName]['children'] = new Array();
|
||||
fspList[nodeName]['mtm'] = mtm;
|
||||
|
||||
|
||||
if ('' == parentName) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (undefined == bpaList[parentName]) {
|
||||
fillList(parentName, 'frame');
|
||||
}
|
||||
|
||||
|
||||
bpaList[parentName].push(nodeName);
|
||||
break;
|
||||
case 'blade':
|
||||
case 'blade':
|
||||
if (undefined == bladeList[mpa]) {
|
||||
bladeList[mpa] = new Array();
|
||||
}
|
||||
bladeList[mpa].push(nodeName + ',' + unit);
|
||||
|
||||
|
||||
break;
|
||||
case 'systemx':
|
||||
case 'systemx':
|
||||
if (!rack) {
|
||||
rack = '_notsupply_';
|
||||
}
|
||||
|
||||
|
||||
if (undefined == rackList[rack]) {
|
||||
rackList[rack] = new Array();
|
||||
}
|
||||
|
||||
|
||||
rackList[rack].push(nodeName + ',' + unit);
|
||||
|
||||
|
||||
break;
|
||||
default:
|
||||
unknownList.push(nodeName);
|
||||
@ -276,8 +276,8 @@ function createGraphical() {
|
||||
|
||||
/**
|
||||
* Create the physical/graphical layout for System p machines
|
||||
*
|
||||
* @param bpa All BPA and their related FSPs
|
||||
*
|
||||
* @param bpa All BPA and their related FSPs
|
||||
* @param fsp All FSP and their related LPARs
|
||||
* @param area The element to append graphical layout
|
||||
*/
|
||||
@ -310,7 +310,7 @@ function createSystempGraphical(bpa, fsp, area) {
|
||||
+ '"><input type="checkbox" class="fspCheckbox" name="check_'
|
||||
+ bpaName + '"></div>');
|
||||
|
||||
// For P7-IH, all the CECs are insert into the frame from bottom to up,
|
||||
// For P7-IH, all the CECs are insert into the frame from bottom to up,
|
||||
// so we have to show the CECs same as the physical layout
|
||||
var tempBlankDiv = $('<div></div>');
|
||||
var tempHeight = 0;
|
||||
@ -322,7 +322,7 @@ function createSystempGraphical(bpa, fsp, area) {
|
||||
if ((0 == fspIndex) && ('9125-F2C' == fsp[fspName]['mtm'])) {
|
||||
frameDiv.append(tempBlankDiv);
|
||||
}
|
||||
|
||||
|
||||
frameDiv.append(createFspDiv(fspName, fsp[fspName]['mtm'], fsp));
|
||||
frameDiv.append(createFspTip(fspName, fsp[fspName]['mtm'], fsp));
|
||||
|
||||
@ -430,7 +430,7 @@ function createSystempGraphical(bpa, fsp, area) {
|
||||
changeNode(lparName, 'unselect');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// No selected LPARs on the cec, so add all LPARs into selectNode hash
|
||||
else {
|
||||
for (var lparIndex in fspList[fspName]['children']) {
|
||||
@ -458,8 +458,8 @@ function createSystempGraphical(bpa, fsp, area) {
|
||||
|
||||
/**
|
||||
* Create the physical/graphical layout for blades
|
||||
*
|
||||
* @param blades The blade list in global
|
||||
*
|
||||
* @param blades The blade list in global
|
||||
* @param area The element to append the graphical layout
|
||||
*/
|
||||
function createBladeGraphical(blades, area) {
|
||||
@ -529,8 +529,8 @@ function createBladeGraphical(blades, area) {
|
||||
|
||||
/**
|
||||
* Create the physical/graphical layout for System x machines
|
||||
*
|
||||
* @param xnodes The system x node list in global
|
||||
*
|
||||
* @param xnodes The system x node list in global
|
||||
* @param area The element to append graphical layout
|
||||
*/
|
||||
function createSystemxGraphical(xnodes, area) {
|
||||
@ -765,7 +765,7 @@ function createFspDiv(fspName, mtm, fsp) {
|
||||
if (lparIndex >= 8) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
var lparName = fsp[fspName]['children'][lparIndex];
|
||||
var color = statusMap(lparList[lparName]);
|
||||
lparStatusRow += '<td class="lparStatus" style="background-image:url(images/nodes/' + color + '.gif);padding: 0px;" id="' + lparName + 'status"></td>';
|
||||
@ -778,11 +778,11 @@ function createFspDiv(fspName, mtm, fsp) {
|
||||
} else {
|
||||
temp = mtm;
|
||||
}
|
||||
|
||||
|
||||
if (!hardwareInfo[temp]){
|
||||
hardwareInfo[temp] = ['unkown', 2];
|
||||
}
|
||||
|
||||
|
||||
if (hardwareInfo[temp][1]) {
|
||||
divClass += 'fspDiv' + hardwareInfo[temp][1];
|
||||
} else {
|
||||
@ -830,7 +830,7 @@ function createFspTip(fspName, mtm, fsp) {
|
||||
}
|
||||
/**
|
||||
* Map the LPAR status into a color
|
||||
*
|
||||
*
|
||||
* @param status LPAR status in nodelist table
|
||||
* @return Corresponding color name
|
||||
*/
|
||||
@ -844,7 +844,7 @@ function statusMap(status) {
|
||||
case 'sshd':
|
||||
case 'booting':
|
||||
case 'booted':
|
||||
case 'ping':
|
||||
case 'ping':
|
||||
color = 'green';
|
||||
break;
|
||||
case 'noping':
|
||||
@ -869,7 +869,7 @@ function selectAllLpars(checkbox) {
|
||||
|
||||
/**
|
||||
* Export all LPAR names from selectNode
|
||||
*
|
||||
*
|
||||
* @return lpars' string
|
||||
*/
|
||||
function getSelectNodes() {
|
||||
@ -904,7 +904,7 @@ function changeNode(lparName, status) {
|
||||
|
||||
/**
|
||||
* The P7-IH's CECs are insert from bottom to up, so we had to calculate the blank height
|
||||
*
|
||||
*
|
||||
* @return Height for the CEC
|
||||
*/
|
||||
function calculateBlank(mtm) {
|
||||
@ -917,13 +917,13 @@ function calculateBlank(mtm) {
|
||||
}
|
||||
|
||||
switch (hardwareInfo[mtm][1]) {
|
||||
case 1:
|
||||
case 1:
|
||||
return 13;
|
||||
break;
|
||||
case 2:
|
||||
case 2:
|
||||
return 24;
|
||||
break;
|
||||
case 4:
|
||||
case 4:
|
||||
return 47;
|
||||
break;
|
||||
default:
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Load updatenode page
|
||||
*
|
||||
*
|
||||
* @param tgtNodes Targets to run updatenode against
|
||||
*/
|
||||
function loadUpdatenodePage(tgtNodes) {
|
||||
@ -17,7 +17,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
|
||||
success : setOSImageCookies
|
||||
});
|
||||
|
||||
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
@ -28,7 +28,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
@ -40,10 +40,10 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
inst = inst + 1;
|
||||
newTabId = 'updatenodeTab' + inst;
|
||||
}
|
||||
|
||||
|
||||
// Create rscan form
|
||||
var updatenodeForm = $('<div class="form"></div>');
|
||||
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'updatenodeStatusBar' + inst;
|
||||
var statusBar = createStatusBar(statBarId).hide();
|
||||
@ -55,35 +55,35 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Update nodes in an xCAT environment');
|
||||
updatenodeForm.append(statusBar, infoBar);
|
||||
|
||||
|
||||
// Create VM fieldset
|
||||
var vmFS = $('<fieldset></fieldset>');
|
||||
var vmLegend = $('<legend>Virtual Machine</legend>');
|
||||
vmFS.append(vmLegend);
|
||||
updatenodeForm.append(vmFS);
|
||||
|
||||
|
||||
var vmAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
vmFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/computer.png"></img></div>'));
|
||||
vmFS.append(vmAttr);
|
||||
|
||||
|
||||
// Create options fieldset
|
||||
var optionsFS = $('<fieldset></fieldset>');
|
||||
var optionsLegend = $('<legend>Options</legend>');
|
||||
optionsFS.append(optionsLegend);
|
||||
updatenodeForm.append(optionsFS);
|
||||
|
||||
|
||||
var optionsAttr = $('<div style="display: inline-table; vertical-align: middle;"></div>');
|
||||
optionsFS.append($('<div style="display: inline-table; vertical-align: middle;"><img src="images/provision/setting.png" style="width: 70px;"></img></div>'));
|
||||
optionsFS.append(optionsAttr);
|
||||
|
||||
|
||||
// Create target node or group input
|
||||
var tgt = $('<div><label>Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to update"/></div>');
|
||||
vmAttr.append(tgt);
|
||||
|
||||
// Create options
|
||||
// Create options
|
||||
var optionsList = $('<ul></ul>');
|
||||
optionsAttr.append(optionsList);
|
||||
|
||||
|
||||
// Create update all software checkbox (only AIX)
|
||||
if (osHash['AIX']) {
|
||||
var updateAllOption = $('<li></li>');
|
||||
@ -91,7 +91,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
updateAllOption.append(updateAllChkBox);
|
||||
optionsList.append(updateAllOption);
|
||||
updateAllOption.append('Install or update all software contained in the source directory');
|
||||
|
||||
|
||||
// Create source directory input
|
||||
var allSwScrDirectory = $('<li><label style="vertical-align: middle">Source directory:</label><input type="text" id="allSwSrcDirectory" name="allSwSrcDirectory"/></li>');
|
||||
// Browse server directory and files
|
||||
@ -131,14 +131,14 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Create update software checkbox
|
||||
var updateOption = $('<li></li>');
|
||||
var updateChkBox = $('<input type="checkbox" id="S" name="S"/>');
|
||||
optionsList.append(updateOption);
|
||||
updateOption.append(updateChkBox);
|
||||
updateOption.append('Update existing software');
|
||||
|
||||
|
||||
// Create source directory input
|
||||
var scrDirectory = $('<li><label style="vertical-align: middle">Source directory:</label><input type="text" id="srcDirectory" name="srcDirectory" title="You must give the source directory containing the updated software packages"/></li>');
|
||||
// Browse server directory and files
|
||||
@ -168,27 +168,27 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
scrDirectory.append(srcDirBrowse);
|
||||
scrDirectory.hide();
|
||||
optionsList.append(scrDirectory);
|
||||
|
||||
|
||||
// Create other packages input
|
||||
var otherPkgs = $('<li><label style="vertical-align: middle">otherpkgs:</label><input type="text" id="otherpkgs" name="otherpkgs"/></li>');
|
||||
otherPkgs.hide();
|
||||
optionsList.append(otherPkgs);
|
||||
|
||||
|
||||
// Create RPM flags input (only AIX)
|
||||
var aixRpmFlags = $('<li><label>rpm_flags:</label><input type="text" name="rpm_flags"/></li>');
|
||||
aixRpmFlags.hide();
|
||||
optionsList.append(aixRpmFlags);
|
||||
|
||||
|
||||
// Create installp flags input (only AIX)
|
||||
var aixInstallPFlags = $('<li><label>installp_flags:</label><input type="text" name="installp_flags"/></li>');
|
||||
aixInstallPFlags.hide();
|
||||
optionsList.append(aixInstallPFlags);
|
||||
|
||||
|
||||
// Create emgr flags input (only AIX)
|
||||
var aixEmgrFlags = $('<li><label>emgr_flags:</label><input type="text" name="emgr_flags"/></li>');
|
||||
aixEmgrFlags.hide();
|
||||
optionsList.append(aixEmgrFlags);
|
||||
|
||||
|
||||
// Show flags when checked
|
||||
updateChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
@ -209,7 +209,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Create postscripts input
|
||||
var postOption = $('<li></li>');
|
||||
var postChkBox = $('<input type="checkbox" id="P" name="P"/>');
|
||||
@ -219,7 +219,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
var postscripts = $('<li><label style="vertical-align: middle">Postscripts:</label><input type="text" id="postscripts" name="postscripts" title="You must give the postscript(s) to run"/></li>');
|
||||
postscripts.hide();
|
||||
optionsList.append(postscripts);
|
||||
|
||||
|
||||
// Show alternate source directory when checked
|
||||
postChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
@ -230,7 +230,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
});
|
||||
optionsList.append('<li><input type="checkbox" id="F" name="F"/>Distribute and synchronize files</li>');
|
||||
optionsList.append('<li><input type="checkbox" id="k" name="k"/>Update the ssh keys and host keys for the service nodes and compute nodes</li>');
|
||||
|
||||
|
||||
// Create update OS checkbox
|
||||
if (!osHash['AIX']) {
|
||||
var osOption = $('<li></li>');
|
||||
@ -238,12 +238,12 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
optionsList.append(osOption);
|
||||
osOption.append(osChkBox);
|
||||
osOption.append('Update the operating system');
|
||||
|
||||
|
||||
var os = $('<li></li>').hide();
|
||||
var osLabel = $('<label>Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os" title="You must give the operating system to upgrade to, e.g. rhel5.5"/>');
|
||||
osInput.one('focus', function(){
|
||||
var tmp = $.cookie('osvers');
|
||||
var tmp = $.cookie('xcat_osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
@ -254,7 +254,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
optionsList.append(os);
|
||||
|
||||
|
||||
// Show alternate source directory when checked
|
||||
osChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
@ -264,7 +264,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Generate tooltips
|
||||
updatenodeForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
@ -279,7 +279,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
@ -292,7 +292,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
// Remove any warning messages
|
||||
$(this).parents('.ui-tabs-panel').find('.ui-state-error').remove();
|
||||
var ready = true;
|
||||
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optionsStr = '';
|
||||
@ -300,7 +300,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
option = chkBoxes.eq(i).attr('name');
|
||||
optionsStr += '-' + option;
|
||||
|
||||
|
||||
// If update all software is checked
|
||||
if (option == 'S') {
|
||||
var srcDir = $('#' + newTabId + ' input[name=allSwSrcDirectory]').val();
|
||||
@ -316,50 +316,50 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
if (srcDirectory) {
|
||||
optionsStr += ';-d;' + srcDirectory;
|
||||
}
|
||||
|
||||
|
||||
// Get otherpkgs
|
||||
var otherpkgs = $('#' + newTabId + ' input[name=otherpkgs]').val();
|
||||
if (otherpkgs) {
|
||||
optionsStr += ';otherpkgs=' + otherpkgs;
|
||||
}
|
||||
|
||||
|
||||
// Get rpm_flags
|
||||
var rpm_flags = $('#' + newTabId + ' input[name=rpm_flags]').val();
|
||||
if (rpm_flags) {
|
||||
optionsStr += ';rpm_flags=' + rpm_flags;
|
||||
}
|
||||
|
||||
|
||||
// Get installp_flags
|
||||
var installp_flags = $('#' + newTabId + ' input[name=installp_flags]').val();
|
||||
if (installp_flags) {
|
||||
optionsStr += ';installp_flags=' + installp_flags;
|
||||
}
|
||||
|
||||
|
||||
// Get emgr_flags
|
||||
var emgr_flags = $('#' + newTabId + ' input[name=emgr_flags]').val();
|
||||
if (emgr_flags) {
|
||||
optionsStr += ';emgr_flags=' + emgr_flags;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If postscripts is checked
|
||||
if (option == 'P') {
|
||||
// Get postscripts
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=postscripts]').val();
|
||||
}
|
||||
|
||||
|
||||
// If operating system is checked
|
||||
if (option == 'o') {
|
||||
// Get the OS
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=os]').val();
|
||||
}
|
||||
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optionsStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
@ -368,7 +368,7 @@ function loadUpdatenodePage(tgtNodes) {
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
|
||||
/**
|
||||
* (1) Boot to network
|
||||
*/
|
||||
|
@ -48,7 +48,7 @@ function loadImages(data) {
|
||||
// Data returned
|
||||
var rsp = data.rsp;
|
||||
if (rsp[0].indexOf('Could not find any object definitions') > -1) {
|
||||
rsp = new Array();
|
||||
rsp = new Array();
|
||||
}
|
||||
|
||||
// Image attributes hash
|
||||
@ -198,7 +198,7 @@ function loadImages(data) {
|
||||
|
||||
// Turn table into a datatable
|
||||
var myDataTable = $('#' + imgTableId).dataTable({
|
||||
'iDisplayLength': 50,
|
||||
'iDisplayLength': 50,
|
||||
'bLengthChange': false,
|
||||
"bScrollCollapse": true,
|
||||
"sScrollY": "400px",
|
||||
@ -502,7 +502,7 @@ function openAddImageDialog() {
|
||||
imageAttr.append(imageName, imageType, architecture, osName, osVersion, profile, provisionMethod);
|
||||
optionAttr.append(otherpkgDirectory, packageDirectory, packageList, template);
|
||||
|
||||
// Generate tooltips
|
||||
// Generate tooltips
|
||||
addImageForm.find('div input[title],select[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
@ -720,9 +720,9 @@ function loadCreateImage() {
|
||||
return;
|
||||
}
|
||||
|
||||
var imageOsVers = $.cookie("osvers").split(",");
|
||||
var imageArch = $.cookie("osarchs").split(",");
|
||||
var profiles = $.cookie("profiles").split(",");
|
||||
var imageOsVers = $.cookie("xcat_osvers").split(",");
|
||||
var imageArch = $.cookie("xcat_osarchs").split(",");
|
||||
var profiles = $.cookie("xcat_profiles").split(",");
|
||||
|
||||
var createImgForm = $('<div class="form"></div>');
|
||||
var createImgFS = $('<fieldset></fieldset>').append('<legend>Create Image</legend>');
|
||||
@ -1329,7 +1329,7 @@ function openCopyCdDialog() {
|
||||
basePath : '/install' // Limit user to only install directory
|
||||
});
|
||||
|
||||
// Generate tooltips
|
||||
// Generate tooltips
|
||||
copyLinuxForm.find('div input[title],select[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
|
@ -33,7 +33,7 @@ function loadProvisionPage() {
|
||||
}
|
||||
|
||||
// Get OS image names
|
||||
if (!$.cookie('imagenames')){
|
||||
if (!$.cookie('xcat_imagenames')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
@ -49,7 +49,7 @@ function loadProvisionPage() {
|
||||
}
|
||||
|
||||
// Get groups
|
||||
if (!$.cookie('groups')){
|
||||
if (!$.cookie('xcat_groups')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
|
@ -73,7 +73,7 @@ function initServicePage() {
|
||||
loadServicePage();
|
||||
|
||||
// Initialize tab index history
|
||||
$.cookie('tabindex_history', '0,0');
|
||||
$.cookie('xcat_tabindex_history', '0,0', { path: '/xcat', secure:true });
|
||||
}
|
||||
|
||||
/**
|
||||
@ -185,14 +185,14 @@ function loadServiceProvisionPage(tabId) {
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
var userName = $.cookie('xcat_username');
|
||||
var tmp = $.cookie(userName + '_usrnodes');
|
||||
var tmp = $.cookie('xcat_' + userName + '_usrnodes');
|
||||
|
||||
// Get maximun number for nodes from cookie
|
||||
var nodes = '';
|
||||
var maxVM = 0;
|
||||
if (tmp.length) {
|
||||
nodes = tmp.split(',');
|
||||
maxVM = parseInt($.cookie(userName + '_maxvm'));
|
||||
maxVM = parseInt($.cookie('xcat_' + userName + '_maxvm'));
|
||||
|
||||
// Do not allow user to clone if the maximum number of VMs is reached
|
||||
if (nodes.length >= maxVM) {
|
||||
@ -302,7 +302,7 @@ function loadManagePage(tabId) {
|
||||
*/
|
||||
function getUserNodesDef() {
|
||||
var userName = $.cookie('xcat_username');
|
||||
var userNodes = $.cookie(userName + '_usrnodes');
|
||||
var userNodes = $.cookie('xcat_' + userName + '_usrnodes');
|
||||
if (userNodes) {
|
||||
// Get nodes definitions
|
||||
$.ajax( {
|
||||
@ -597,7 +597,7 @@ function loadNodesTable(data) {
|
||||
|
||||
// Refresh nodes table
|
||||
var userName = $.cookie('xcat_username');
|
||||
var userNodes = $.cookie(userName + '_usrnodes');
|
||||
var userNodes = $.cookie('xcat_' + userName + '_usrnodes');
|
||||
if (userNodes) {
|
||||
// Get nodes definitions
|
||||
$.ajax( {
|
||||
@ -932,7 +932,7 @@ function setGroupCookies(data) {
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie('srv_groups', groups, { expires: exDate });
|
||||
$.cookie('xcat_srv_groups', groups, { expires: exDate, path: '/xcat', secure:true });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1041,28 +1041,28 @@ function setOSImageCookies(data) {
|
||||
}
|
||||
|
||||
// Save image names in a cookie
|
||||
$.cookie('srv_imagenames', imageNames);
|
||||
$.cookie('xcat_srv_imagenames', imageNames);
|
||||
|
||||
// Save profiles in a cookie
|
||||
var tmp = new Array;
|
||||
for (var key in profilesHash) {
|
||||
tmp.push(key);
|
||||
}
|
||||
$.cookie('srv_profiles', tmp);
|
||||
$.cookie('xcat_srv_profiles', tmp);
|
||||
|
||||
// Save OS versions in a cookie
|
||||
tmp = new Array;
|
||||
for (var key in osVersHash) {
|
||||
tmp.push(key);
|
||||
}
|
||||
$.cookie('srv_osvers', tmp);
|
||||
$.cookie('xcat_srv_osvers', tmp);
|
||||
|
||||
// Save OS architectures in a cookie
|
||||
tmp = new Array;
|
||||
for (var key in osArchsHash) {
|
||||
tmp.push(key);
|
||||
}
|
||||
$.cookie('srv_osarchs', tmp);
|
||||
$.cookie('xcat_srv_osarchs', tmp);
|
||||
}
|
||||
|
||||
|
||||
@ -1111,7 +1111,7 @@ function setUserNodes(data) {
|
||||
// Set cookie to expire in 240 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie(userName + '_usrnodes', usrNodes, { expires: exDate });
|
||||
$.cookie('xcat_' + userName + '_usrnodes', usrNodes, { expires: exDate, path: '/xcat', secure:true });
|
||||
} // End of if
|
||||
}
|
||||
|
||||
@ -1316,10 +1316,10 @@ function monitorNode(node, monitor) {
|
||||
function cloneNode(tgtNodes) {
|
||||
var userName = $.cookie('xcat_username');
|
||||
var nodes = tgtNodes.split(',');
|
||||
var tmp = $.cookie(userName + '_usrnodes');
|
||||
var tmp = $.cookie('xcat_' + userName + '_usrnodes');
|
||||
var usrNodes = tmp.split(',');
|
||||
|
||||
var maxVM = parseInt($.cookie(userName + '_maxvm'));
|
||||
var maxVM = parseInt($.cookie('xcat_' + userName + '_maxvm'));
|
||||
|
||||
// Do not allow user to clone if the maximum number of VMs is reached
|
||||
if (usrNodes.length >= maxVM) {
|
||||
@ -1596,7 +1596,7 @@ function unlockNode(tgtNodes) {
|
||||
*/
|
||||
function getNodesCurrentLoad(){
|
||||
var userName = $.cookie('xcat_username');
|
||||
var nodes = $.cookie(userName + '_usrnodes');
|
||||
var nodes = $.cookie('xcat_' + userName + '_usrnodes');
|
||||
|
||||
// Get nodes current status
|
||||
$.ajax({
|
||||
@ -2147,7 +2147,7 @@ function setMaxVM() {
|
||||
// Set cookie to expire in 60 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie(userName + '_maxvm', rsp, { expires: exDate });
|
||||
$.cookie('xcat_' + userName + '_maxvm', rsp, { expires: exDate });
|
||||
}
|
||||
});
|
||||
}
|
@ -4,30 +4,30 @@
|
||||
$(document).ready(function() {
|
||||
$('#header').remove();
|
||||
$('#content').remove();
|
||||
|
||||
|
||||
var winHeight = document.body.clientHeight;
|
||||
var diagHeight = $('#login').css('height');
|
||||
diagHeight = diagHeight.substr(0, diagHeight.length - 2);
|
||||
diagHeight = Number(diagHeight);
|
||||
|
||||
|
||||
// The window's height is to small to show the dialog
|
||||
var tmpHeight = 0;
|
||||
if ((winHeight - 50) < diagHeight){
|
||||
tmpHeight = 0;
|
||||
} else {
|
||||
tmpHeight = parseInt((winHeight - diagHeight - 50) / 2);
|
||||
tmpHeight = parseInt((winHeight - diagHeight - 50) / 2);
|
||||
}
|
||||
|
||||
|
||||
$('#login').css('margin', tmpHeight + 'px auto');
|
||||
$('button').bind('click', function(){
|
||||
authenticate();
|
||||
}).button();
|
||||
|
||||
|
||||
if (document.location.protocol == 'http:') {
|
||||
$('#login-status').html('You are using an unencrypted session!');
|
||||
$('#login-status').css('color', 'red');
|
||||
}
|
||||
|
||||
|
||||
if (!$("#login input[name='username']").val()) {
|
||||
$("#login input[name='username']").focus();
|
||||
} else {
|
||||
@ -51,7 +51,7 @@ $(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Update login dialog
|
||||
*
|
||||
*
|
||||
* @param data Data returned from AJAX call
|
||||
* @param txtStatus Status of login
|
||||
*/
|
||||
@ -62,11 +62,11 @@ function onlogin(data, txtStatus) {
|
||||
if (data.authenticated == 'yes') {
|
||||
$('#login-status').text('Login successful');
|
||||
window.location = 'service.php';
|
||||
|
||||
|
||||
// Set user name cookie
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie('xcat_username', usrName, { expires: exDate });
|
||||
$.cookie('xcat_username', usrName, { expires: exDate, path: '/xcat', secure:true });
|
||||
} else {
|
||||
$('#login-status').text('Authentication failure');
|
||||
$('#login-status').css('color', '#FF0000');
|
||||
@ -79,7 +79,7 @@ function onlogin(data, txtStatus) {
|
||||
function authenticate() {
|
||||
$('#login-status').css('color', '#000000');
|
||||
$('#login-status').html('Authenticating...');
|
||||
|
||||
|
||||
var passwd = $("#login input[name='password']").val();
|
||||
$.post('lib/srv_log.php', {
|
||||
username : $("#login input[name='username']").val(),
|
||||
|
@ -1,8 +1,11 @@
|
||||
/**
|
||||
* Tab constructor
|
||||
*
|
||||
* @param tabId Tab ID
|
||||
* @param tabName Tab name
|
||||
* @param tabId
|
||||
* Tab ID
|
||||
* @param tabName
|
||||
* Tab name
|
||||
* @return Nothing
|
||||
*/
|
||||
var Tab = function(tabId) {
|
||||
this.tabId = tabId;
|
||||
@ -29,8 +32,8 @@ Tab.prototype.init = function() {
|
||||
tabs.bind('tabsselect', function(event, ui){
|
||||
// Save the order tabs were selected
|
||||
var order;
|
||||
if ($.cookie('tabindex_history')) {
|
||||
order = $.cookie('tabindex_history').split(',');
|
||||
if ($.cookie('xcat_tabindex_history')) {
|
||||
order = $.cookie('xcat_tabindex_history').split(',');
|
||||
order[1] = order[0]; // Set index 1 to last selected tab
|
||||
order[0] = ui.index; // Set index 0 to currently selected tab
|
||||
} else {
|
||||
@ -40,7 +43,7 @@ Tab.prototype.init = function() {
|
||||
order[1] = ui.index;
|
||||
}
|
||||
|
||||
$.cookie('tabindex_history', order);
|
||||
$.cookie('xcat_tabindex_history', order, { path: '/xcat', secure:true });
|
||||
});
|
||||
|
||||
// Remove dummy tab
|
||||
@ -97,7 +100,7 @@ Tab.prototype.add = function(tabId, tabName, tabCont, closeable) {
|
||||
// Go back to last tab if user is trying to close currently selected tab
|
||||
if (tabs.tabs('option', 'selected') == tabIndex) {
|
||||
// Get last selected tab from history
|
||||
var order = $.cookie('tabindex_history').split(',');
|
||||
var order = $.cookie('xcat_tabindex_history').split(',');
|
||||
if (order[1]) {
|
||||
tabs.tabs('select', parseInt(order[1]));
|
||||
} else {
|
||||
|
@ -4,32 +4,32 @@
|
||||
$(document).ready(function() {
|
||||
$('#header').remove();
|
||||
$('#content').remove();
|
||||
|
||||
|
||||
var winheight = document.body.clientHeight;
|
||||
var diaheight = $('#login').css('height');
|
||||
diaheight = diaheight.substr(0, diaheight.length - 2);
|
||||
diaheight = Number(diaheight);
|
||||
|
||||
|
||||
// The window's height is to small to show the dialog
|
||||
var tempheight = 0;
|
||||
if ((winheight - 50) < diaheight){
|
||||
tempheight = 0;
|
||||
} else {
|
||||
tempheight = parseInt((winheight - diaheight - 50) / 2);
|
||||
tempheight = parseInt((winheight - diaheight - 50) / 2);
|
||||
}
|
||||
|
||||
|
||||
$('#login').css('margin', tempheight + 'px auto');
|
||||
$('button').bind('click', function(){
|
||||
authenticate();
|
||||
});
|
||||
|
||||
|
||||
$('#login button').button();
|
||||
|
||||
|
||||
if (document.location.protocol == "http:") {
|
||||
$("#login-status").html("You are using an unencrypted session!");
|
||||
$("#login-status").css("color", "#ff0000");
|
||||
}
|
||||
|
||||
|
||||
if ($("#login input[name='username']").val() == "") {
|
||||
$("#login input[name='username']").focus();
|
||||
} else {
|
||||
@ -53,7 +53,7 @@ $(document).ready(function() {
|
||||
|
||||
/**
|
||||
* Update login dialog
|
||||
*
|
||||
*
|
||||
* @param data Data returned from AJAX call
|
||||
* @param txtStatus Status of login
|
||||
*/
|
||||
@ -64,25 +64,26 @@ function onlogin(data, txtStatus) {
|
||||
$("#login-status").text("Login successful");
|
||||
|
||||
// Not the first time to log
|
||||
if ($.cookie('logonflag')){
|
||||
if ($.cookie('xcat_logonflag')){
|
||||
// Remembered what page they were trying to go to
|
||||
window.location = window.location.pathname;
|
||||
} else {
|
||||
window.location = 'help.php';
|
||||
}
|
||||
|
||||
|
||||
// Set user name cookie
|
||||
var usrName = $("#login input[name='username']").val();
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie('xcat_username', usrName, { expires: exDate });
|
||||
|
||||
$.cookie('xcat_username', usrName, { expires: exDate, path: '/xcat', secure:true });
|
||||
|
||||
// Set the logonflag
|
||||
$.cookie('logonflag', 'yes', {
|
||||
$.cookie('xcat_logonflag', 'yes', {
|
||||
path : '/xcat',
|
||||
expires : 100
|
||||
expires : 100,
|
||||
secure:true
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
$("#login-status").text("Authentication failure").css("color", "#FF0000");
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
if ($flush){
|
||||
echo str_pad('',1024)."\n";
|
||||
}
|
||||
|
||||
|
||||
while (!feof($fp)) {
|
||||
// Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
@ -118,7 +118,7 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
} else {
|
||||
$flushtail = '';
|
||||
}
|
||||
|
||||
|
||||
$str = preg_replace('/<errorcode>.*<\/errorcode>/', '', $str);
|
||||
// Strip HTML tags from output
|
||||
if ($tmp = trim(strip_tags($str))) {
|
||||
@ -127,7 +127,7 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
format_TBD($tmp);
|
||||
} else {
|
||||
$tmp = preg_replace('/\n\s*/', "\n", $tmp);
|
||||
|
||||
|
||||
// Print out output by default
|
||||
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
|
||||
ob_flush();
|
||||
@ -180,7 +180,7 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
$rsp = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
@ -201,10 +201,10 @@ function xorcrypt($data, $key) {
|
||||
* Get password
|
||||
*/
|
||||
function getpassword() {
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
if (isset($GLOBALS['xcat_authsecret'])) {
|
||||
$cryptext = $GLOBALS['xcat_authsecret'];
|
||||
} else if (isset($_COOKIE["xcat_authsecret"])) {
|
||||
$cryptext = $_COOKIE["xcat_authsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -214,7 +214,7 @@ function getpassword() {
|
||||
|
||||
/**
|
||||
* Get the password splitting knowledge between server and client side persistant storage.
|
||||
* Caller should regenerate session ID when contemplating a new user/password,
|
||||
* Caller should regenerate session ID when contemplating a new user/password,
|
||||
* to preclude session fixation, though fixation is limited without the secret.
|
||||
*
|
||||
* @param $password Password
|
||||
@ -226,8 +226,8 @@ function setpassword($password) {
|
||||
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
setcookie("xcat_authsecret",$cryptext,0,'/xcat','',true);
|
||||
$GLOBALS["xcat_authsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
}
|
||||
|
||||
@ -342,18 +342,31 @@ function isRootAcess() {
|
||||
* Log out of current user session
|
||||
*/
|
||||
function logout() {
|
||||
session_start();
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
if (isset($_COOKIE["xcat_authsecret"])) {
|
||||
setcookie("xcat_authsecret",'',time()-86400*7,'/xcat','',true);
|
||||
}
|
||||
|
||||
// Clear any cookies where the key starts with "xcat_"
|
||||
foreach ($_COOKIE as $key => $value) {
|
||||
if (substr($key,0,5) === "xcat_") {
|
||||
unset($_COOKIE[$key]);
|
||||
setcookie($key, null, time() - 3600, '/xcat','',true);
|
||||
}
|
||||
}
|
||||
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
setcookie(session_name(),"",time()-86400*7,"/xcat",'',true);
|
||||
}
|
||||
|
||||
// Clear session id
|
||||
setcookie(session_id(),"",time()-86400*7,"/");
|
||||
|
||||
// Clear server store of data
|
||||
$_SESSION=array();
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,10 +208,10 @@ function format_TBD($str) {
|
||||
* Get password
|
||||
*/
|
||||
function getpassword() {
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
if (isset($GLOBALS['xcat_authsecret'])) {
|
||||
$cryptext = $GLOBALS['xcat_authsecret'];
|
||||
} else if (isset($_COOKIE["xcat_authsecret"])) {
|
||||
$cryptext = $_COOKIE["xcat_authsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -233,8 +233,8 @@ function setpassword($password) {
|
||||
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
setcookie("xcat_authsecret",$cryptext,0,'/xcat','',true);
|
||||
$GLOBALS["xcat_authsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
}
|
||||
|
||||
@ -285,13 +285,13 @@ function isAuthenticated() {
|
||||
*/
|
||||
function logout() {
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
if (isset($_COOKIE["xcat_authsecret"])) {
|
||||
setcookie("xcat_authsecret",'',time()-86400*7,'/xcat','',true);
|
||||
}
|
||||
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
setcookie(session_name(),"",time()-86400*7,"/xcat",'',true);
|
||||
}
|
||||
|
||||
// Clear server store of data
|
||||
|
Loading…
x
Reference in New Issue
Block a user