diff --git a/perl-xCAT/xCAT/zvmUtils.pm b/perl-xCAT/xCAT/zvmUtils.pm
index de8e528fa..a7ee21798 100644
--- a/perl-xCAT/xCAT/zvmUtils.pm
+++ b/perl-xCAT/xCAT/zvmUtils.pm
@@ -682,7 +682,7 @@ sub getMdisks {
sub getDedicates {
# Get inputs
- my ( $class, $user, $callback, $node ) = @_;
+ my ( $class, $callback, $user, $node ) = @_;
my $sudo = "sudo";
if ($user eq "root") {
@@ -697,18 +697,18 @@ sub getDedicates {
my $propVals = xCAT::zvmUtils->getNodeProps( 'zvm', $node, @propNames );
my $hcp = $propVals->{'hcp'};
- # Get node userID
+ # Get node userId
my $userId = $propVals->{'userid'};
- my $out = `ssh $user\@$hcp "$sudo $dir/getuserentry $userId" | grep "DEDICATE"`;
-
+ my $out = `ssh $user\@$hcp "$sudo $dir/smcli Image_Query_DM -T $userId" | egrep -i "DEDICATE"`;
+
# Get DEDICATE statements
my @lines = split( '\n', $out );
my @dedicates;
foreach (@lines) {
$_ = xCAT::zvmUtils->trimStr($_);
- # Save MDISK statements
+ # Save statements
push( @dedicates, $_ );
}
diff --git a/xCAT-UI/js/configure/service.js b/xCAT-UI/js/configure/service.js
index 376ed0148..00a4fb9ea 100644
--- a/xCAT-UI/js/configure/service.js
+++ b/xCAT-UI/js/configure/service.js
@@ -62,7 +62,7 @@ function loadServicePage(tabId) {
// Get zVM host names
if (!$.cookie('zvms')){
$.ajax( {
- url : 'lib/srv_cmd.php',
+ url : 'lib/cmd.php',
dataType : 'json',
data : {
cmd : 'webportal',
@@ -487,8 +487,15 @@ function imageDialog() {
* @param iComments Image description
*/
function editImageDialog(iName, iSelectable, iOsVersion, iOsArch, iOsName, iType, iProfile, iMethod, iComments) {
- // Create form to add profile
- var dialogId = 'editImage';
+ var inst = 0;
+ var dialogId = 'editImage' + inst;
+ while ($('#' + dialogId).length) {
+ // If one already exists, generate another one
+ inst = inst + 1;
+ dialogId = 'editImage' + inst;
+ }
+
+ // Create form to add profile
var imageForm = $('
');
// Create info bar
@@ -529,7 +536,7 @@ function editImageDialog(iName, iSelectable, iOsVersion, iOsArch, iOsName, iType
imageForm.find('div input[title],textarea[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
- effect: "fade",
+ effect: "toggle",
opacity: 0.8,
delay: 0,
predelay: 800,
@@ -1019,7 +1026,7 @@ function groupDialog() {
*/
function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iNetwork, iComments) {
// Create form to add profile
- var dialogId = 'createGroup';
+ var dialogId = 'createGroup-' + iGroup;
var groupForm = $('');
// Create info bar
@@ -1047,7 +1054,7 @@ function editGroupDialog(iGroup, iSelectable, iIp, iHostnames, iNetwork, iCommen
groupForm.find('div input[title],textarea[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
- effect: "fade",
+ effect: "toggle",
opacity: 0.8,
delay: 0,
predelay: 800,
diff --git a/xCAT-UI/js/custom/zvmUtils.js b/xCAT-UI/js/custom/zvmUtils.js
index 0df7bd9e1..27a50451c 100644
--- a/xCAT-UI/js/custom/zvmUtils.js
+++ b/xCAT-UI/js/custom/zvmUtils.js
@@ -1440,15 +1440,7 @@ function openAddZfcpDialog(node, hcp, zvm) {
var portName = $('');
var unitNo = $('');
advanced.append(portName, unitNo);
-
- var wwpns = $.cookie(zvm + 'wwpns');
- if (wwpns) {
- // Turn on auto complete
- portName.find('input').autocomplete({
- source: wwpns.split(',')
- });
- }
-
+
// Toggle port name and unit number when clicking on advanced link
advancedLnk.click(function() {
advanced.toggle();
@@ -1509,14 +1501,14 @@ function openAddZfcpDialog(node, hcp, zvm) {
loaddev = 0;
}
- var args = '--addzfcp;' + pool + ';' + address + ';' + loaddev + ';' + size;
+ var args = '--addzfcp||' + pool + '||' + address + '||' + loaddev + '||' + size;
if (tag && tag != "null") {
- args += ';' + tag;
+ args += '||' + tag;
} if (portName && tag != "null") {
- args += ';' + portName;
+ args += '||' + portName;
} if (unitNo && tag != "null") {
- args += ';' + unitNo;
+ args += '||' + unitNo;
}
// Add zFCP device
@@ -2064,7 +2056,6 @@ function openAddScsi2SystemDialog(hcp) {
var fcpWwpn = $(' | ');
devPathRow.append(fcpWwpn);
- var wwpns = "";
if ($.cookie('zvms')) {
zvms = $.cookie('zvms').split(',');
var zvm;
@@ -2072,14 +2063,7 @@ function openAddScsi2SystemDialog(hcp) {
var args = zvms[i].split(':');
var zvm = args[0].toLowerCase();
var iHcp = args[1];
-
- wwpns += "," + $.cookie(zvm + 'wwpns');
}
-
- wwpns = wwpns.replace(',,', ',');
- fcpWwpn.find('input').autocomplete({
- source: wwpns.split(',')
- });
}
// Create FCP LUN input
@@ -2112,9 +2096,6 @@ function openAddScsi2SystemDialog(hcp) {
// Create FCP WWPN input
var fcpWwpn = $(' | ');
devPathRow.append(fcpWwpn);
- fcpWwpn.find('input').autocomplete({
- source: wwpns.split(',')
- });
// Create FCP LUN input
var fcpLun = $(' | ');
@@ -5457,40 +5438,6 @@ function createZProvisionNew(inst) {
return provNew;
}
-/**
- * Load WWPNs
- */
-function loadWwpns() {
- if (!$.cookie('zvms')) {
- return;
- }
-
- // Retrieve WWPNs found on z/VM system
- var zvms = $.cookie('zvms').split(',');
- for (var i in zvms) {
- args = zvms[i].split(':');
- zvm = args[0].toLowerCase();
- hcp = args[1];
-
- if (!$.cookie(zvm + 'wwpns')) {
- $.ajax({
- url : 'lib/cmd.php',
- dataType : 'json',
- data : {
- cmd : 'rinv',
- tgt : zvm,
- args : '--wwpn',
- msg : zvm
- },
-
- success : function(data) {
- setWwpnCookies(data);
- }
- });
- }
- }
-}
-
/**
* Load zVMs into column (service page)
*
@@ -5696,26 +5643,6 @@ function setZfcpPoolCookies(data) {
}
}
-/**
- * Set a cookie for WWPNs of z/VM system
- *
- * @param data Data from HTTP request
- */
-function setWwpnCookies(data) {
- if (data.rsp[0].length) {
- var zvm = data.msg;
- var wwpns = data.rsp[0].split(zvm + ': ');
- for (var i in wwpns) {
- wwpns[i] = jQuery.trim(wwpns[i]);
- }
-
- // Set cookie to expire in 60 minutes
- var exDate = new Date();
- exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
- $.cookie(zvm + 'wwpns', wwpns, { expires: exDate });
- }
-}
-
/**
* Create virtual machine (service page)
*
@@ -5839,7 +5766,7 @@ function configProfilePanel(panelId) {
deleteLnk.click(function() {
var profiles = getNodesChecked(tableId);
if (profiles) {
- openDeleteProfileDialog(profiles);
+ deleteProfileDialog(profiles);
}
});
@@ -6191,7 +6118,7 @@ function editProfileDialog(profile, pool, size, entry) {
profileForm.find('div input[title],textarea[title],select[title]').tooltip({
position: "center right",
offset: [-2, 10],
- effect: "fade",
+ effect: "toggle",
opacity: 0.8,
delay: 0,
predelay: 800,
@@ -6239,6 +6166,10 @@ function editProfileDialog(profile, pool, size, entry) {
}
});
+ // A newline at the end of directory entry is needed
+ entry = entry.replace(/^\s+|\s+$/g, '');
+ entry += '\n';
+
// Write file to /var/tmp
$.ajax({
url : 'lib/cmd.php',
diff --git a/xCAT-UI/js/nodes/nodes.js b/xCAT-UI/js/nodes/nodes.js
index bd867788b..668704211 100644
--- a/xCAT-UI/js/nodes/nodes.js
+++ b/xCAT-UI/js/nodes/nodes.js
@@ -3276,7 +3276,6 @@ function advancedLoad(group){
success : function(data) {
setzVMCookies(data);
- loadWwpns();
}
});
}
diff --git a/xCAT-UI/js/service/service.js b/xCAT-UI/js/service/service.js
index 0b545debd..9cae5e602 100644
--- a/xCAT-UI/js/service/service.js
+++ b/xCAT-UI/js/service/service.js
@@ -114,47 +114,45 @@ function loadServicePage() {
}
});
+ // Get OS image names
+ $.ajax({
+ url : 'lib/srv_cmd.php',
+ dataType : 'json',
+ async : true,
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : 'osimage',
+ msg : ''
+ },
+
+ success : function(data) {
+ setOSImageCookies(data);
+ }
+ });
+
+ // Get contents of hosts table
+ $.ajax({
+ url : 'lib/srv_cmd.php',
+ dataType : 'json',
+ async : true,
+ data : {
+ cmd : 'tabdump',
+ tgt : '',
+ args : 'hosts',
+ msg : ''
+ },
+
+ success : function(data) {
+ setGroupCookies(data);
+ }
+ });
+
var provTabId = 'provisionTab';
serviceTabs.add(provTabId, 'Provision', '', false);
loadServiceProvisionPage(provTabId);
serviceTabs.select(manageTabId);
-
- // Get OS image names
- if (!$.cookie('srv_imagenames')){
- $.ajax( {
- url : 'lib/srv_cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : 'osimage',
- msg : ''
- },
-
- success : function(data) {
- setOSImageCookies(data);
- }
- });
- }
-
- // Get contents of hosts table
- if (!$.cookie('srv_groups')) {
- $.ajax( {
- url : 'lib/srv_cmd.php',
- dataType : 'json',
- data : {
- cmd : 'tabdump',
- tgt : '',
- args : 'hosts',
- msg : ''
- },
-
- success : function(data) {
- setGroupCookies(data);
- }
- });
- }
}
/**
diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm
index ff8dd5b85..9e4c933e0 100644
--- a/xCAT-server/lib/xcat/plugins/zvm.pm
+++ b/xCAT-server/lib/xcat/plugins/zvm.pm
@@ -1054,7 +1054,7 @@ sub changeVM {
# #status,wwpn,lun,size,range,owner,channel,tag
# used,1000000000000000,2000000000000110,8g,3B00-3B3F,ihost1,1a23,$root_device$
# free,1000000000000000,2000000000000111,,3B00-3B3F,,,
- # free,1230000000000000,2000000000000112,,3B00-3B3F,,,
+ # free,1230000000000000;4560000000000000,2000000000000112,,3B00-3B3F,,,
if (!$useWwpnLun) {
my @devices = split("\n", `ssh $::SUDOER\@$hcp "$::SUDO cat $::ZFCPPOOL/$pool.conf" | egrep -i free`);
$sizeFound = 0;
@@ -1165,7 +1165,14 @@ sub changeVM {
return;
}
}
-
+
+ # If there are multiple devices (multipathing), take the 1st one
+ my $origDevice = $device;
+ if ($device =~ m/;/i) {
+ @tmp = split(';', $device);
+ $device = xCAT::zvmUtils->trimStr($tmp[0]);
+ }
+
# Make sure channel has a length of 4
while (length($device) < 4) {
$device = "0" . $device;
@@ -1282,7 +1289,7 @@ sub changeVM {
$out = `ssh $::SUDOER\@$hcp "$::SUDO sed --in-place -e $expression $::ZFCPPOOL/$pool.conf"`;
} else {
# Insert device entry into file
- $out = `ssh $::SUDOER\@$hcp "$::SUDO echo \"used,$origWwpn,$lun,$size,,$node,$device,$tag\" >> $::ZFCPPOOL/$pool.conf"`;
+ $out = `ssh $::SUDOER\@$hcp "$::SUDO echo \"used,$origWwpn,$lun,$size,,$node,$origDevice,$tag\" >> $::ZFCPPOOL/$pool.conf"`;
}
xCAT::zvmUtils->printLn($callback, "$node: Adding FCP device... Done");
@@ -4849,7 +4856,7 @@ sub nodeSet {
my $entry;
my $zfcpSection = "";
foreach (@pools) {
- $entry = `ssh $::SUDOER\@$hcp "$::SUDO cat $::ZFCPPOOL/$_" | egrep -i $userId`;
+ $entry = `ssh $::SUDOER\@$hcp "$::SUDO cat $::ZFCPPOOL/$_" | egrep -i ",$node,"`;
chomp($entry);
if (!$entry) {
next;
@@ -4858,12 +4865,23 @@ sub nodeSet {
# Go through each zFCP device
my @device = split('\n', $entry);
foreach (@device) {
- # Each entry contains: status,wwpn,lun,size,owner,channel,tag
+ # Each entry contains: status,wwpn,lun,size,range,owner,channel,tag
@tmp = split(',', $_);
my $wwpn = $tmp[1];
my $lun = $tmp[2];
- my $device = $tmp[5];
- my $tag = $tmp[6];
+ my $device = $tmp[6];
+ my $tag = $tmp[7];
+
+ # If multiple WWPNs or device channels are specified (multipathing), just take the 1st one
+ if ($wwpn =~ m/;/i) {
+ @tmp = split(';', $wwpn);
+ $wwpn = xCAT::zvmUtils->trimStr($tmp[0]);
+ }
+
+ if ($device =~ m/;/i) {
+ @tmp = split(';', $device);
+ $device = xCAT::zvmUtils->trimStr($tmp[0]);
+ }
# Make sure WWPN and LUN do not have 0x prefix
$wwpn = xCAT::zvmUtils->replaceStr($wwpn, "0x", "");
@@ -5055,7 +5073,7 @@ END
my $entry;
my $zfcpSection = "";
foreach (@pools) {
- $entry = `ssh $::SUDOER\@$hcp "$::SUDO cat $::ZFCPPOOL/$_" | egrep -i $userId`;
+ $entry = `ssh $::SUDOER\@$hcp "$::SUDO cat $::ZFCPPOOL/$_" | egrep -i ",$node,"`;
chomp($entry);
if (!$entry) {
next;
@@ -5064,12 +5082,23 @@ END
# Go through each zFCP device
my @device = split('\n', $entry);
foreach (@device) {
- # Each entry contains: status,wwpn,lun,size,owner,channel,tag
+ # Each entry contains: status,wwpn,lun,size,range,owner,channel,tag
@tmp = split(',', $_);
my $wwpn = $tmp[1];
my $lun = $tmp[2];
- my $device = $tmp[5];
- my $tag = $tmp[6];
+ my $device = $tmp[6];
+ my $tag = $tmp[7];
+
+ # If multiple WWPNs or device channels are specified (multipathing), just take the 1st one
+ if ($wwpn =~ m/;/i) {
+ @tmp = split(';', $wwpn);
+ $wwpn = xCAT::zvmUtils->trimStr($tmp[0]);
+ }
+
+ if ($device =~ m/;/i) {
+ @tmp = split(';', $device);
+ $device = xCAT::zvmUtils->trimStr($tmp[0]);
+ }
# Make sure WWPN and LUN do not have 0x prefix
$wwpn = xCAT::zvmUtils->replaceStr($wwpn, "0x", "");
@@ -5162,7 +5191,11 @@ END
# Concat dedicated devices and DASD together
if ($devices) {
- $dasd = $dasd . "," . $devices;
+ if ($dasd) {
+ $dasd = $dasd . "," . $devices;
+ } else {
+ $dasd = $devices;
+ }
}
# Create parmfile -- Limited to 80 characters/line, maximum of 11 lines
@@ -6650,6 +6683,68 @@ sub inventoryHypervisor {
}
}
+ # luns [fcp_device] (supported only on z/VM 6.2)
+ elsif ( $args->[0] eq "--luns" ) {
+ # Find the LUNs accessible thru given zFCP device
+ my $fcp = lc($args->[1]);
+ my $argsSize = @{$args};
+ if ($argsSize < 2) {
+ xCAT::zvmUtils->printLn( $callback, "$node: (Error) Wrong number of parameters" );
+ return;
+ }
+
+ $out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli System_FCP_Free_Query -T $hcpUserId -k fcp_dev=$fcp" | egrep -i "FCP device number:|World wide port number:|Logical unit number:|Number of bytes residing on the logical unit:"`;
+
+ my @wwpns = split( "\n", $out );
+ my %map;
+
+ my $wwpn = "";
+ my $lun = "";
+ my $size = "";
+ foreach (@wwpns) {
+ # Extract the device number
+ if ($_ =~ "World wide port number:") {
+ $_ =~ s/^\s+World wide port number:(.*)/$1/;
+ $_ =~ s/^\s+//;
+ $_ =~ s/\s+$//;
+ $wwpn = $_;
+
+ if (!scalar($map{$wwpn})) {
+ $map{$wwpn} = {};
+ }
+ } elsif ($_ =~ "Logical unit number:") {
+ $_ =~ s/^\s+Logical unit number:(.*)/$1/;
+ $_ =~ s/^\s+//;
+ $_ =~ s/\s+$//;
+ $lun = $_;
+
+ $map{$wwpn}{$lun} = "";
+ } elsif ($_ =~ "Number of bytes residing on the logical unit:") {
+ $_ =~ s/^\s+Number of bytes residing on the logical unit:(.*)/$1/;
+ $_ =~ s/^\s+//;
+ $_ =~ s/\s+$//;
+ $size = $_;
+
+ $map{$wwpn}{$lun} = $size;
+ }
+ }
+
+ xCAT::zvmUtils->printLn($callback, "#status,wwpn,lun,size,range,owner,channel,tag");
+ foreach $wwpn (sort keys %map) {
+ foreach $lun (sort keys %{$map{$wwpn}}) {
+ # status, wwpn, lun, size, range, owner, channel, tag
+ $size = sprintf("%.1f", $map{$wwpn}{$lun}/1073741824); # Convert size to GB
+
+ if ($size > 0) {
+ $size .= "G";
+ xCAT::zvmUtils->printLn($callback, "unknown,$wwpn,$lun,$size,,,,");
+ }
+ }
+ }
+
+ $str = "";
+ }
+
# networknames
elsif ( $args->[0] eq "--networknames" || $args->[0] eq "--getnetworknames" ) {
$str = xCAT::zvmCPUtils->getNetworkNames($::SUDOER, $hcp);
@@ -6771,20 +6866,29 @@ sub inventoryHypervisor {
$str = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Virtual_Network_Vswitch_Query_Stats -T $hcpUserId $argStr"`;
}
- # wwpn
- elsif ( $args->[0] eq "--wwpn" ) {
- $out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli System_WWPN_Query -T $hcpUserId" | egrep -i "Physical world wide port number"`;
+ # wwpn [fcp_device] (supported only on z/VM 6.2)
+ elsif ( $args->[0] eq "--wwpns" ) {
+ my $fcp = lc($args->[1]);
+ my $argsSize = @{$args};
+ if ($argsSize < 2) {
+ xCAT::zvmUtils->printLn( $callback, "$node: (Error) Wrong number of parameters" );
+ return;
+ }
+
+ $out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli System_FCP_Free_Query -T $hcpUserId -k fcp_dev=$fcp" | egrep -i "World wide port number:"`;
my @wwpns = split( "\n", $out );
my %uniqueWwpns;
foreach (@wwpns) {
# Extract the device number
- $_ =~ s/^\s+Physical world wide port number:(.*)/$1/;
- $_ =~ s/^\s+//;
- $_ =~ s/\s+$//;
-
- # Save only unique WWPNs
- $uniqueWwpns{$_} = 1;
+ if ($_ =~ "World wide port number:") {
+ $_ =~ s/^\s+World wide port number:(.*)/$1/;
+ $_ =~ s/^\s+//;
+ $_ =~ s/\s+$//;
+
+ # Save only unique WWPNs
+ $uniqueWwpns{$_} = 1;
+ }
}
my $wwpn;