diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js
index 91d1b8dc6..e3b1fef24 100644
--- a/xCAT-UI/js/custom/zvmUtils.js
+++ b/xCAT-UI/js/custom/zvmUtils.js
@@ -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 });
}
}
diff --git a/xCAT-UI/js/monitor/gangliamon.js b/xCAT-UI/js/monitor/gangliamon.js
index d0a533c57..f7d573ed1 100644
--- a/xCAT-UI/js/monitor/gangliamon.js
+++ b/xCAT-UI/js/monitor/gangliamon.js
@@ -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('', 'node', 'ping
',
- 'power
', 'ganglia
');
+ sorted.unshift('',
+ 'node',
+ 'status
',
+ 'power
',
+ 'ganglia
');
// 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 = '';
// Open node onclick
var nodeLink = $('' + node + '').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( {
diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js
index beed72e77..4a7b05f14 100644
--- a/xCAT-UI/js/nodes/nodes.js
+++ b/xCAT-UI/js/nodes/nodes.js
@@ -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('',
'node',
'status
',
- 'power
',
+ 'power
',
'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 = '';
// Open node onclick
var nodeLink = $('' + node + '').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
}