From d485f74ed3505611404d948d251559283653d2d8 Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 3 Nov 2010 16:23:54 +0000 Subject: [PATCH] Checked if SMAPI is running before getting disk pools and network names. If SMAPI is offline, then allow the user to restart it. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8021 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/zvmUtils.js | 123 ++++++++++++++++++++++++++++++++++ xCAT-UI/js/nodes/nodes.js | 32 +++------ 2 files changed, 133 insertions(+), 22 deletions(-) diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js index 7f2f8284a..7f161a732 100644 --- a/xCAT-UI/js/custom/zvmUtils.js +++ b/xCAT-UI/js/custom/zvmUtils.js @@ -46,6 +46,129 @@ function setNetworkDataTable(table) { networkDatatable = table; } +/** + * Load HCP specific info + * + * @param data + * Data from HTTP request + * @return Nothing + */ +function loadHcpInfo(data) { + var args = data.msg.split(';'); + + // Get group + var group = args[0].replace('group=', ''); + // Get hardware control point + var hcp = args[1].replace('hcp=', ''); + + // Get user directory entry + var userEntry = data.rsp; + if (userEntry) { + // Get disk pools + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'lsvm', + tgt : hcp, + args : '--diskpoolnames', + msg : hcp + }, + + success : setDiskPoolCookies + }); + + // Get network names + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'lsvm', + tgt : hcp, + args : '--getnetworknames', + msg : hcp + }, + + success : setNetworkCookies + }); + } else { + // Create warning dialog + var warnDialog = $('
' + + '

' + + 'z/VM SMAPI is not responding to ' + hcp + '. It needs to be reset.

' + + '
'); + + // Open dialog + warnDialog.dialog({ + modal: true, + width: 400, + buttons: { + "Reset": function(){ + $(this).dialog("close"); + + // Reset SMAPI + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'chvm', + tgt : hcp, + args : '--resetsmapi', + msg : 'group=' + group + ';hcp=' + hcp + }, + + /** + * Refresh group tab + * + * @param data + * Data from HTTP request + * @return Nothing + */ + success : function(data) { + var args = data.msg.split(';'); + + // Get group + var group = args[0].replace('group=', ''); + // Get hardware control point + var hcp = args[1].replace('hcp=', ''); + + // Clear nodes division + $('#nodes').children().remove(); + // Create loader + var loader = $('
').append(createLoader()); + + // Create a tab for this group + var tab = new Tab(); + setNodesTab(tab); + tab.init(); + $('#nodes').append(tab.object()); + tab.add('nodesTab', 'Nodes', loader, false); + + // Get nodes within selected group + $.ajax( { + url : 'lib/cmd.php', + dataType : 'json', + data : { + cmd : 'lsdef', + tgt : '', + args : group, + msg : group + }, + + success : loadNodes + }); + } // End of function + }); + }, + + "Ignore": function() { + $(this).dialog("close"); + } + } + }); + } +} + /** * Load user entry of a given node * diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js index ed5896b2c..0caacb38e 100644 --- a/xCAT-UI/js/nodes/nodes.js +++ b/xCAT-UI/js/nodes/nodes.js @@ -563,36 +563,24 @@ function loadNodes(data) { for ( var h in hcps) { // Get node without domain name args = h.split('.'); - - // Get disk pools + + // Check if SMAPI is online $.ajax( { url : 'lib/cmd.php', dataType : 'json', data : { cmd : 'lsvm', tgt : args[0], - args : '--diskpoolnames', - msg : args[0] + args : '', + msg : 'group=' + group + ';hcp=' + args[0] }, - success : setDiskPoolCookies - }); - - // Get network names - $.ajax( { - url : 'lib/cmd.php', - dataType : 'json', - data : { - cmd : 'lsvm', - tgt : args[0], - args : '--getnetworknames', - msg : args[0] - }, - - success : setNetworkCookies - }); - } - } + // Load hardware control point (HCP) specific info + // Get disk pools and network names + success : loadHcpInfo + }); + } // End of for + } // End of if } /**