From 09938be4d8a369d82156937e01f1205ebd742472 Mon Sep 17 00:00:00 2001 From: phamt Date: Tue, 10 Jul 2012 14:18:38 +0000 Subject: [PATCH] Synched z/VM code in 2.7 branch with trunk git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@13268 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/custom/zvm.js | 34 +++++++++++++++++++++-------- xCAT-server/lib/xcat/plugins/zvm.pm | 15 +++++++++---- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/xCAT-UI/js/custom/zvm.js b/xCAT-UI/js/custom/zvm.js index 9a6eac09b..ff826074e 100644 --- a/xCAT-UI/js/custom/zvm.js +++ b/xCAT-UI/js/custom/zvm.js @@ -194,11 +194,19 @@ zvmPlugin.prototype.loadServiceInventory = function(data) { var tabId = args[0].replace('out=', ''); // Get node var node = args[1].replace('node=', ''); - // Get node inventory - var inv = data.rsp[0].split(node + ':'); - + // Remove loader $('#' + tabId).find('img').remove(); + + // Do not continue if error is found + if (data.rsp[0].indexOf('Error') > -1) { + var warn = createWarnBar(data.rsp[0]); + $('#' + tabId).append(warn); + return; + } + + // Get node inventory + var inv = data.rsp[0].split(node + ':'); // Create array of property keys var keys = new Array('userId', 'host', 'os', 'arch', 'hcp', 'priv', 'memory', 'proc', 'disk', 'nic'); @@ -738,13 +746,13 @@ zvmPlugin.prototype.loadClonePage = function(node) { } // If an IP address range is given and the starting and ending index do not match - if (ipRange && !(nodeStart == ipStart) || !(nodeEnd == ipEnd)) { + if (ipRange && (!(nodeStart == ipStart) || !(nodeEnd == ipEnd))) { errMsg = errMsg + 'The node range and IP address range does not match. '; ready = false; } // If a hostname range is given and the starting and ending index do not match - if (hostnameRange && !(nodeStart == hostnameStart) || !(nodeEnd == hostnameEnd)) { + if (hostnameRange && (!(nodeStart == hostnameStart) || !(nodeEnd == hostnameEnd))) { errMsg = errMsg + 'The node range and hostname range does not match. '; ready = false; } @@ -900,11 +908,19 @@ zvmPlugin.prototype.loadInventory = function(data) { var tabId = args[0].replace('out=', ''); // Get node var node = args[1].replace('node=', ''); - // Get node inventory - var inv = data.rsp[0].split(node + ':'); - + // Remove loader $('#' + tabId).find('img').remove(); + + // Do not continue if error is found + if (data.rsp[0].indexOf('Error') > -1) { + var warn = createWarnBar(data.rsp[0]); + $('#' + tabId).append(warn); + return; + } + + // Get node inventory + var inv = data.rsp[0].split(node + ':'); // Create status bar var statBarId = node + 'StatusBar'; @@ -979,7 +995,7 @@ zvmPlugin.prototype.loadInventory = function(data) { }); // Align toggle link to the right - var toggleLnkDiv = $('
').css( { + var toggleLnkDiv = $('
').css({ 'text-align' : 'right' }); toggleLnkDiv.append(toggleLink); diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index 3cc3147db..6b64afaeb 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -1579,6 +1579,16 @@ sub inventoryVM { # Get inputs my ( $callback, $node, $args ) = @_; + + # Output string + my $str = ""; + + # Check if node is pingable + if (`nodestat $node | egrep -i "noping"`) { + $str = "$node: (Error) Host is unreachable"; + xCAT::zvmUtils->printLn( $callback, "$str" ); + return; + } # Get node properties from 'zvm' table my @propNames = ( 'hcp', 'userid' ); @@ -1598,10 +1608,7 @@ sub inventoryVM { return; } # Capitalize user ID - $userId =~ tr/a-z/A-Z/; - - # Output string - my $str = ""; + $userId =~ tr/a-z/A-Z/; # Load VMCP module xCAT::zvmCPUtils->loadVmcp($node);