Allow multiple WWPNs to be specified in zFCP pool.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15063 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2013-02-05 16:02:21 +00:00
parent 23b37343b2
commit a28999ba55
2 changed files with 35 additions and 4 deletions

View File

@ -2116,4 +2116,34 @@ sub querySSI {
$ssi =~ s/^\s*//;
return $ssi;
}
#-------------------------------------------------------
=head3 rExecute
Description : Execute a remote command
Arguments : User (root or non-root)
Node
Returns : Output returned from executing command
Example : my $out = xCAT::zvmUtils->rExecute($user, $node, $cmd);
=cut
#-------------------------------------------------------
sub rExecute {
my ( $class, $user, $node, $cmd ) = @_;
my $out;
my $sudo = "sudo";
if ($user eq "root") {
# Just execute the command if root
$out = `ssh $user\@$node "$cmd"`;
return $out;
}
# Encapsulate command in single quotes
$cmd = "'" . $cmd . "'";
$out = `ssh $user\@$node "$sudo sh -c $cmd"`;
return $out;
}

View File

@ -1082,6 +1082,7 @@ sub changeVM {
# If there are multiple paths, take the 1st one
# Handle multi-pathing in postscript because autoyast/kickstart does not support it.
my $origWwpn = $wwpn;
if ($wwpn =~ m/;/i) {
@tmp = split(';', $wwpn);
$wwpn = xCAT::zvmUtils->trimStr($tmp[0]);
@ -1233,12 +1234,12 @@ sub changeVM {
}
# Entry order: status,wwpn,lun,size,owner,channel,tag
my $update = "used,$wwpn,$lun,$info[3],$info[4],$node,$device,$tag";
my $update = "used,$info[1],$lun,$info[3],$info[4],$node,$device,$tag";
my $expression = "'s#" . $select . "#" .$update . "#i'";
$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,$wwpn,$lun,$size,,$node,$device,$tag\" >> $::ZFCPPOOL/$pool.conf"`;
$out = `ssh $::SUDOER\@$hcp "$::SUDO echo \"used,$origWwpn,$lun,$size,,$node,$device,$tag\" >> $::ZFCPPOOL/$pool.conf"`;
}
xCAT::zvmUtils->printLn($callback, "$node: Adding FCP device... Done");
@ -1538,13 +1539,13 @@ sub changeVM {
my $mode = $args->[3];
# Dedicate device to directory entry
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Device_Dedicate_DM -T $userId -v $vaddr -r $raddr -o $mode"`;
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Device_Dedicate_DM -T $userId -v $vaddr -r $raddr -R $mode"`;
xCAT::zvmUtils->printLn( $callback, "$node: $out" );
# Dedicate device to active configuration
my $ping = `pping $node`;
if (!($ping =~ m/noping/i)) {
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Device_Dedicate -T $userId -v $vaddr -r $raddr -o $mode"`;
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Image_Device_Dedicate -T $userId -v $vaddr -r $raddr -R $mode"`;
xCAT::zvmUtils->printLn( $callback, "$node: $out" );
}