Synched up with code in 2.8 branch.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15161 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2013-02-12 22:59:26 +00:00
parent 8b1334a3d6
commit f9f370cd5f
3 changed files with 511 additions and 379 deletions

View File

@ -387,7 +387,7 @@ sub getIp {
# Get IP address
# You need the extra space in the pattern,
# else it will confuse gpok2 with gpok21
my $out = `cat /etc/hosts | grep "$node "`;
my $out = `cat /etc/hosts | egrep -i "$node | $node."`;
my @parms = split( ' ', $out );
return $parms[0];

File diff suppressed because it is too large Load Diff

View File

@ -4479,10 +4479,14 @@ sub nodeSet {
}
# Get host IP and hostname from /etc/hosts
$out = `cat /etc/hosts | grep "$node "`;
$out = `cat /etc/hosts | egrep -i "$node |$node."`;
my @words = split( ' ', $out );
my $hostIP = $words[0];
my $hostname = $words[2];
if (!($hostname =~ m/./i)) {
$hostname = $words[1];
}
if ( !$hostIP || !$hostname ) {
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Missing IP for $node in /etc/hosts" );
xCAT::zvmUtils->printLn( $callback, "$node: (Solution) Verify that the nodes IP address is specified in the hosts table and then run makehosts" );
@ -5603,10 +5607,14 @@ sub updateNode {
my $installDir = $entries[0];
# Get host IP and hostname from /etc/hosts
my $out = `cat /etc/hosts | grep $node`;
my $out = `cat /etc/hosts | egrep -i "$node |$node."`;
my @words = split( ' ', $out );
my $hostIP = $words[0];
my $hostname = $words[2];
if (!($hostname =~ m/./i)) {
$hostname = $words[1];
}
if ( !$hostIP || !$hostname ) {
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Missing IP for $node in /etc/hosts" );
xCAT::zvmUtils->printLn( $callback, "$node: (Solution) Verify that the node's IP address is specified in the hosts table and then run makehosts" );
@ -6018,7 +6026,7 @@ sub changeHypervisor {
}
# addeckd [dev_no]
if ( $args->[0] eq "--addeckd" ) {
elsif ( $args->[0] eq "--addeckd" ) {
my $argsSize = @{$args};
if ($argsSize != 2) {
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Wrong number of parameters" );
@ -6029,7 +6037,6 @@ sub changeHypervisor {
# Add an ECKD disk to a running z/VM system
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli System_Disk_Add -T $hcpUserId -k $devNo"`;
$out = xCAT::zvmUtils->appendHostname( $node, $out );
}
# addscsi [dev_no] [dev_path] [option] [persist]
@ -6099,17 +6106,22 @@ sub changeHypervisor {
$out .= `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli Virtual_Network_LAN_Create -T $hcpUserId -n $name -o $owner -t $type -p $transport"`;
}
# addvswitch [name] [osa_dev_addr] [osa_exp_adapter] [controller] [connect (0, 1, or 2)] [memory_queue] [router] [transport] [vlan_id] [port_type] [update] [gvrp] [native_vlan]
# addvswitch [name] [osa_dev_addr] [port_name] [controller] [connect (0, 1, or 2)] [memory_queue] [router] [transport] [vlan_id] [port_type] [update] [gvrp] [native_vlan]
elsif ( $args->[0] eq "--addvswitch" ) {
my $i;
my $argStr = "";
my $argsSize = @{$args};
if ($argsSize < 5) {
xCAT::zvmUtils->printLn( $callback, "$node: (Error) Wrong number of parameters" );
return;
}
my @options = ("", "-n", "-r", "-a", "-i", "-c", "-q", "-e", "-t", "-v", "-p", "-u", "-G", "-V");
foreach $i ( 1 .. $argsSize ) {
if ( $args->[$i] ) {
# Prepend options prefix to argument
$argStr .= "$options[$i] $args->[$i] ";
$argStr .= "$options[$i] $args->[$i] ";
}
}
@ -6159,13 +6171,7 @@ sub changeHypervisor {
# Create pool directory
$out = `ssh $::SUDOER\@$hcp "$::SUDO mkdir -p $::ZFCPPOOL"`;
}
if (!(`ssh $::SUDOER\@$hcp "$::SUDO test -e $::ZFCPPOOL/$pool.conf && echo Exists"`)) {
# Create pool configuration file
$out = xCAT::zvmUtils->rExecute($::SUDOER, $hcp, "echo '#status,wwpn,lun,size,range,owner,channel,tag' > $::ZFCPPOOL/$pool.conf");
xCAT::zvmUtils->printLn( $callback, "$node: New zFCP device pool $pool created" );
}
# Change the file owner if using a sudoer
if ($::SUDOER ne "root") {
my $priv = xCAT::zvmUtils->trimStr(`ssh $::SUDOER\@$hcp "$::SUDO stat -c \"%G:%U\" /var/opt/zhcp"`);
@ -6173,6 +6179,12 @@ sub changeHypervisor {
`ssh $::SUDOER\@$hcp "$::SUDO chown -R $::SUDOER:users /var/opt/zhcp"`;
}
}
if (!(`ssh $::SUDOER\@$hcp "$::SUDO test -e $::ZFCPPOOL/$pool.conf && echo Exists"`)) {
# Create pool configuration file
$out = `ssh $::SUDOER\@$hcp "$::SUDO echo '#status,wwpn,lun,size,range,owner,channel,tag' > $::ZFCPPOOL/$pool.conf"`;
xCAT::zvmUtils->printLn( $callback, "$node: New zFCP device pool $pool created" );
}
# Do not update if the LUN already exists
if (`ssh $::SUDOER\@$hcp "$::SUDO cat $::ZFCPPOOL/$pool.conf" | grep $lun`) {
@ -6233,7 +6245,6 @@ sub changeHypervisor {
# Delete a real SCSI disk
$out = `ssh $::SUDOER\@$hcp "$::SUDO $::DIR/smcli System_SCSI_Disk_Delete -T $hcpUserId -k $devNo -k $persist"`;
$out = xCAT::zvmUtils->appendHostname( $node, $out );
}
# removevlan [name] [owner]
@ -6243,7 +6254,6 @@ sub changeHypervisor {
# Delete a virtual network
$out = `ssh $hcp "$::DIR/smcli Virtual_Network_LAN_Delete -T $hcpUserId -n $name -o $owner"`;
$out = xCAT::zvmUtils->appendHostname( $node, $out );
}
# removevswitch [name]
@ -6252,7 +6262,6 @@ sub changeHypervisor {
# Delete a VSWITCH
$out = `ssh $hcp "$::DIR/smcli Virtual_Network_Vswitch_Delete -T $hcpUserId -n $name"`;
$out = xCAT::zvmUtils->appendHostname( $node, $out );
}
# removezfcpfrompool [pool] [lun] [wwpn (optional)]