Added option to query all accessible LUNs. Fixed query WWPNs.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15170 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
7fd00ce8ae
commit
7ba40528e4
@ -1440,15 +1440,7 @@ function openAddZfcpDialog(node, hcp, zvm) {
|
||||
var portName = $('<div><label>Port name:</label><input type="text" name="diskPortName" title="The hexadecimal digits designating the 8-byte fibre channel port name of the FCP-I/O device"/></div>');
|
||||
var unitNo = $('<div><label>Unit number:</label><input type="text" name="diskUnitNo" title="The hexadecimal digits representing the 8-byte logical unit number of the FCP-I/O device"/></div>');
|
||||
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();
|
||||
@ -2064,7 +2056,6 @@ function openAddScsi2SystemDialog(hcp) {
|
||||
var fcpWwpn = $('<td><input type="text" style="width: 100px;" name="fcpWwpn" maxlength="16" title="The FCP world wide port number"/></td>');
|
||||
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 = $('<td><input type="text" style="width: 100px;" name="fcpWwpn" maxlength="16" title="The world wide port number"/></td>');
|
||||
devPathRow.append(fcpWwpn);
|
||||
fcpWwpn.find('input').autocomplete({
|
||||
source: wwpns.split(',')
|
||||
});
|
||||
|
||||
// Create FCP LUN input
|
||||
var fcpLun = $('<td><input type="text" style="width: 100px;" name="fcpLun" maxlength="16" title="The logical unit number"/></td>');
|
||||
@ -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)
|
||||
*
|
||||
|
@ -3276,7 +3276,6 @@ function advancedLoad(group){
|
||||
|
||||
success : function(data) {
|
||||
setzVMCookies(data);
|
||||
loadWwpns();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -6650,6 +6650,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 +6833,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;
|
||||
|
Loading…
Reference in New Issue
Block a user