Changed code to not request power status until user clicks on power. Used current cookie until it expired (5 minutes expiration).
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8360 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
b8e6c0057f
commit
b4e976013a
@ -65,33 +65,39 @@ function loadHcpInfo(data) {
|
||||
var userEntry = data.rsp;
|
||||
if (userEntry[0].indexOf('Failed') < 0) {
|
||||
if (hcp) {
|
||||
// Get disk pools
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsvm',
|
||||
tgt : hcp,
|
||||
args : '--diskpoolnames',
|
||||
msg : hcp
|
||||
},
|
||||
// If there is no cookie for the disk pool names
|
||||
if (!$.cookie(hcp + 'diskpools')) {
|
||||
// Get disk pools
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsvm',
|
||||
tgt : hcp,
|
||||
args : '--diskpoolnames',
|
||||
msg : hcp
|
||||
},
|
||||
|
||||
success : setDiskPoolCookies
|
||||
});
|
||||
}
|
||||
|
||||
success : setDiskPoolCookies
|
||||
});
|
||||
|
||||
// Get network names
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsvm',
|
||||
tgt : hcp,
|
||||
args : '--getnetworknames',
|
||||
msg : hcp
|
||||
},
|
||||
|
||||
success : setNetworkCookies
|
||||
});
|
||||
// If there is no cookie for the network names
|
||||
if (!$.cookie(hcp + 'networks')) {
|
||||
// Get network names
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsvm',
|
||||
tgt : hcp,
|
||||
args : '--getnetworknames',
|
||||
msg : hcp
|
||||
},
|
||||
|
||||
success : setNetworkCookies
|
||||
});
|
||||
}
|
||||
} // End of if (hcp)
|
||||
} else {
|
||||
// Create warning dialog
|
||||
@ -1694,7 +1700,11 @@ function setDiskPoolCookies(data) {
|
||||
if (data.rsp) {
|
||||
var node = data.msg;
|
||||
var pools = data.rsp[0].split(node + ': ');
|
||||
$.cookie(node + 'diskpools', pools);
|
||||
|
||||
// Set cookie to expire in 5 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (5 * 60 * 1000));
|
||||
$.cookie(node + 'diskpools', pools, { expires: exDate });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1709,7 +1719,11 @@ function setNetworkCookies(data) {
|
||||
if (data.rsp) {
|
||||
var node = data.msg;
|
||||
var networks = data.rsp[0].split(node + ': ');
|
||||
$.cookie(node + 'networks', networks);
|
||||
|
||||
// Set cookie to expire in 5 minutes
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (5 * 60 * 1000));
|
||||
$.cookie(node + 'networks', networks, { expires: exDate });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,6 +267,9 @@ function loadNodes4Ganglia(data) {
|
||||
// Node attributes
|
||||
var headers = new Object();
|
||||
|
||||
// Variable to send command and request node status
|
||||
var getNodeStatus = true;
|
||||
|
||||
var node;
|
||||
var args;
|
||||
for ( var i in rsp) {
|
||||
@ -289,18 +292,30 @@ function loadNodes4Ganglia(data) {
|
||||
// Create a hash table
|
||||
attrs[node][key] = val;
|
||||
headers[key] = 1;
|
||||
|
||||
// If the node status is available
|
||||
if (key == 'status') {
|
||||
// Do not send command to request node status
|
||||
getNodeStatus = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Sort headers
|
||||
var sorted = new Array();
|
||||
for ( var key in headers) {
|
||||
sorted.push(key);
|
||||
// Do not put comments and status in
|
||||
if (key != 'usercomment' && key.indexOf('status') < 0) {
|
||||
sorted.push(key);
|
||||
}
|
||||
}
|
||||
sorted.sort();
|
||||
|
||||
// Add column for check box, node, ping, and power
|
||||
sorted.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">', 'node', '<a>ping</a><img src="images/loader.gif"></img>',
|
||||
'<a>power</a><img src="images/loader.gif"></img>', '<a>ganglia</a><img src="images/loader.gif"></img>');
|
||||
sorted.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">',
|
||||
'node',
|
||||
'<a>status</a><img src="images/loader.gif"></img>',
|
||||
'<a>power</a><img src="images/loader.gif" style="display: none;"></img>',
|
||||
'<a>ganglia</a><img src="images/loader.gif"></img>');
|
||||
|
||||
// Create a datatable
|
||||
var dTable = new DataTable('nodesDataTable');
|
||||
@ -310,21 +325,29 @@ function loadNodes4Ganglia(data) {
|
||||
for ( var node in attrs) {
|
||||
// Create a row
|
||||
var row = new Array();
|
||||
|
||||
// Create a check box
|
||||
var checkBx = '<input type="checkbox" name="' + node + '"/>';
|
||||
// Open node onclick
|
||||
var nodeLink = $('<a class="node" id="' + node + '">' + node + '</a>').bind('click', loadNode);
|
||||
row.push(checkBx, nodeLink, '', '', '');
|
||||
// Get node status
|
||||
var status = attrs[node]['status'].replace('sshd', 'ping');
|
||||
|
||||
row.push(checkBx, nodeLink, status, '', '');
|
||||
|
||||
// Go through each header
|
||||
for ( var i = 5; i < sorted.length; i++) {
|
||||
// Add the node attributes to the row
|
||||
var key = sorted[i];
|
||||
var val = attrs[node][key];
|
||||
if (val) {
|
||||
row.push(val);
|
||||
} else {
|
||||
row.push('');
|
||||
|
||||
// Do not put comments and status in
|
||||
if (key != 'usercomment' && key.indexOf('status') < 0) {
|
||||
var val = attrs[node][key];
|
||||
if (val) {
|
||||
row.push(val);
|
||||
} else {
|
||||
row.push('');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -448,36 +471,29 @@ function loadNodes4Ganglia(data) {
|
||||
});
|
||||
|
||||
/**
|
||||
* Get power and ping status for each node
|
||||
* Get node and ganglia status
|
||||
*/
|
||||
|
||||
// Get the power status
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpower',
|
||||
tgt : group,
|
||||
args : 'stat',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : loadPowerStatus
|
||||
});
|
||||
|
||||
// Get the node status
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodestat',
|
||||
tgt : group,
|
||||
args : '',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : loadNodeStatus
|
||||
});
|
||||
|
||||
// If request to get node status is made
|
||||
if (getNodeStatus) {
|
||||
// Get the node status
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodestat',
|
||||
tgt : group,
|
||||
args : '',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : loadNodeStatus
|
||||
});
|
||||
} else {
|
||||
// Hide status loader
|
||||
var statCol = $('#nodesDataTable thead tr th').eq(2);
|
||||
statCol.find('img').hide();
|
||||
}
|
||||
|
||||
// Get the status of Ganglia
|
||||
$.ajax( {
|
||||
|
@ -333,6 +333,9 @@ function loadNodes(data) {
|
||||
// Node attributes
|
||||
var headers = new Object();
|
||||
|
||||
// Variable to send command and request node status
|
||||
var getNodeStatus = true;
|
||||
|
||||
// Clear cookie containing list of nodes where
|
||||
// their attributes need to be updated
|
||||
$.cookie('nodes2update', '');
|
||||
@ -361,8 +364,14 @@ function loadNodes(data) {
|
||||
// Create a hash table
|
||||
attrs[node][key] = val;
|
||||
headers[key] = 1;
|
||||
|
||||
// If the node status is available
|
||||
if (key == 'status') {
|
||||
// Do not send command to request node status
|
||||
getNodeStatus = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Save attributes in hash table
|
||||
origAttrs = attrs;
|
||||
|
||||
@ -377,10 +386,11 @@ function loadNodes(data) {
|
||||
sorted.sort();
|
||||
|
||||
// Add column for check box, node, ping, power, and comments
|
||||
// Power status for nodes will not be requested until user clicks on power link
|
||||
sorted.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">',
|
||||
'node',
|
||||
'<a>status</a><img src="images/loader.gif"></img>',
|
||||
'<a>power</a><img src="images/loader.gif"></img>',
|
||||
'<a>power</a><img src="images/loader.gif" style="display: none;"></img>',
|
||||
'comments');
|
||||
|
||||
// Create a datatable
|
||||
@ -391,12 +401,16 @@ function loadNodes(data) {
|
||||
for (var node in attrs) {
|
||||
// Create a row
|
||||
var row = new Array();
|
||||
|
||||
// Create a check box
|
||||
var checkBx = '<input type="checkbox" name="' + node + '"/>';
|
||||
// Open node onclick
|
||||
var nodeLink = $('<a class="node" id="' + node + '">' + node + '</a>').bind('click', loadNode);
|
||||
// Push in checkbox, node link, ping, and power
|
||||
row.push(checkBx, nodeLink, '', '');
|
||||
// Get node status
|
||||
var status = attrs[node]['status'].replace('sshd', 'ping');
|
||||
|
||||
// Push in checkbox, node link, status, and power
|
||||
row.push(checkBx, nodeLink, status, '');
|
||||
|
||||
// Put in comments
|
||||
var comment = attrs[node]['usercomment'];
|
||||
@ -712,35 +726,29 @@ function loadNodes(data) {
|
||||
});
|
||||
|
||||
/**
|
||||
* Get power and ping for each node
|
||||
* Get the node status and definable node attributes
|
||||
*/
|
||||
// Get power status
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpower',
|
||||
tgt : group,
|
||||
args : 'stat',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : loadPowerStatus
|
||||
});
|
||||
|
||||
// Get node status
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodestat',
|
||||
tgt : group,
|
||||
args : '',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : loadNodeStatus
|
||||
});
|
||||
// If request to get node status is made
|
||||
if (getNodeStatus) {
|
||||
// Get node status
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodestat',
|
||||
tgt : group,
|
||||
args : '',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : loadNodeStatus
|
||||
});
|
||||
} else {
|
||||
// Hide status loader
|
||||
var statCol = $('#nodesDataTable thead tr th').eq(2);
|
||||
statCol.find('img').hide();
|
||||
}
|
||||
|
||||
// Get definable node attributes
|
||||
$.ajax( {
|
||||
@ -774,21 +782,25 @@ function loadNodes(data) {
|
||||
for (var h in hcps) {
|
||||
// Get node without domain name
|
||||
args = h.split('.');
|
||||
// Check if SMAPI is online
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsvm',
|
||||
tgt : args[0],
|
||||
args : '',
|
||||
msg : 'group=' + group + ';hcp=' + args[0]
|
||||
},
|
||||
|
||||
// Load hardware control point (HCP) specific info
|
||||
// Get disk pools and network names
|
||||
success : loadHcpInfo
|
||||
});
|
||||
|
||||
// If there is no disk pool or network names cookie for this zHCP
|
||||
if (!$.cookie(args[0] + 'diskpools') || !$.cookie(args[0] + 'networks')) {
|
||||
// Check if SMAPI is online
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'lsvm',
|
||||
tgt : args[0],
|
||||
args : '',
|
||||
msg : 'group=' + group + ';hcp=' + args[0]
|
||||
},
|
||||
|
||||
// Load hardware control point (HCP) specific info
|
||||
// Get disk pools and network names
|
||||
success : loadHcpInfo
|
||||
});
|
||||
}
|
||||
} // End of for
|
||||
} // End of if
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user