diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index 9e4c933e0..b324cf388 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -685,9 +685,9 @@ sub removeVM { @luns = split("\n", `ssh $::SUDOER\@$hcp "$::SUDO cat $::ZFCPPOOL/$_" | egrep -i $node`); foreach (@luns) { - # Update entry: status,wwpn,lun,size,owner,channel,tag + # Update entry: status,wwpn,lun,size,range,owner,channel,tag my @info = split(',', $_); - $update = "free,$info[1],$info[2],$info[3],,,"; + $update = "free,$info[1],$info[2],$info[3],$info[4],,,"; $expression = "'s#" . $_ . "#" .$update . "#i'"; $out = `ssh $::SUDOER\@$hcp "$::SUDO sed --in-place -e $expression $::ZFCPPOOL/$pool.conf"`; } @@ -4397,9 +4397,44 @@ sub nodeSet { } # Capitalize user ID $userId =~ tr/a-z/A-Z/; + + my $action = $args->[0]; + + # Handle case where osimage is specified + my $os; + my $arch; + my $profile; + my $provMethod; + my $osImg = $args->[0]; + if ($osImg =~ m/osimage=/i) { + $osImg =~ s/osimage=//; + $osImg =~ s/^\s+//; + $osImg =~ s/\s+$//; + + @propNames = ('profile', 'provmethod', 'osvers', 'osarch'); + $propVals = xCAT::zvmUtils->getTabPropsByKey( 'osimage', 'imagename', $osImg, @propNames ); + + # Update nodetype table with os, arch, and profile based on osimage + if ( !$propVals->{'profile'} || !$propVals->{'provmethod'} || !$propVals->{'osvers'} || !$propVals->{'osarch'} ) { + # Exit + xCAT::zvmUtils->printLn( $callback, "$node: (Error) Missing profile, provmethod, osvers, or osarch for osimage" ); + xCAT::zvmUtils->printLn( $callback, "$node: (Solution) Provide profile, provmethod, osvers, and osarch in the osimage definition" ); + return; + } + + # Update nodetype table with osimage attributes for node + my %propHash = ( + 'os' => $propVals->{'osvers'}, + 'arch' => $propVals->{'osarch'}, + 'profile' => $propVals->{'profile'}, + 'provmethod' => $propVals->{'provmethod'} + ); + xCAT::zvmUtils->setNodeProps( 'nodetype', $node, \%propHash ); + $action = $propVals->{'provmethod'}; + } # Get install directory and domain from site table - my @entries = xCAT::TableUtils->get_site_attribute("installdir"); + my @entries = xCAT::TableUtils->get_site_attribute("installdir"); my $installDir = $entries[0]; @entries = xCAT::TableUtils->get_site_attribute("domain"); my $domain = $entries[0]; @@ -4412,9 +4447,9 @@ sub nodeSet { @propNames = ( 'os', 'arch', 'profile' ); $propVals = xCAT::zvmUtils->getNodeProps( 'nodetype', $node, @propNames ); - my $os = $propVals->{'os'}; - my $arch = $propVals->{'arch'}; - my $profile = $propVals->{'profile'}; + $os = $propVals->{'os'}; + $arch = $propVals->{'arch'}; + $profile = $propVals->{'profile'}; # If no OS, arch, or profile is found if ( !$os || !$arch || !$profile ) { @@ -4425,7 +4460,6 @@ sub nodeSet { } # Get action - my $action = $args->[0]; my $out; if ( $action eq "install" ) { @@ -4869,7 +4903,7 @@ sub nodeSet { @tmp = split(',', $_); my $wwpn = $tmp[1]; my $lun = $tmp[2]; - my $device = $tmp[6]; + my $device = lc($tmp[6]); my $tag = $tmp[7]; # If multiple WWPNs or device channels are specified (multipathing), just take the 1st one @@ -5086,7 +5120,7 @@ END @tmp = split(',', $_); my $wwpn = $tmp[1]; my $lun = $tmp[2]; - my $device = $tmp[6]; + my $device = lc($tmp[6]); my $tag = $tmp[7]; # If multiple WWPNs or device channels are specified (multipathing), just take the 1st one