diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 6ee5d7e5f..171ab4e9b 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -788,7 +788,7 @@ sub mkinstall my %osents = %{$ostab->getNodesAttribs(\@nodes, ['profile', 'os', 'arch', 'provmethod'])}; my %rents = %{$restab->getNodesAttribs(\@nodes, - ['nfsserver', 'tftpdir', 'primarynic', 'installnic'])}; + ['xcatmaster', 'nfsserver', 'tftpdir', 'primarynic', 'installnic'])}; my %hents = %{$hmtab->getNodesAttribs(\@nodes, ['serialport', 'serialspeed', 'serialflow'])}; @@ -806,6 +806,15 @@ sub mkinstall my $pkglistfile; my $imagename; my $platform; + my $xcatmaster; + + my $ient = $rents->{$node}->[0]; + if ($ient and $ient->{xcatmaster}) + { + $xcatmaster = $ient->{xcatmaster}; + } else { + $xcatmaster = '!myipfn!'; + } my $osinst; if ($rents{$node}->[0] and $rents{$node}->[0]->{tftpdir}) { @@ -1058,7 +1067,7 @@ sub mkinstall # 'serialport', 'serialspeed', 'serialflow' # ] # ); - my $instserver='!myipfn!'; #default to autodetect from boot server + my $instserver = $xcatmaster; if ($ent and $ent->{nfsserver}) { $instserver=$ent->{nfsserver}; } diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index a7bb7b0ae..a5955dcc7 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -562,7 +562,7 @@ sub mkinstall $restab->getNodesAttribs( \@nodes, [ - 'nfsserver', 'tftpdir', + 'nfsserver', 'tftpdir','xcatmaster', 'primarynic', 'installnic' ] ); @@ -776,7 +776,13 @@ sub mkinstall #We have a shot... my $ent = $resents->{$node}->[0]; my $sent = $hments->{$node}->[0]; #hmtab->getNodeAttribs($node, ['serialport', 'serialspeed', 'serialflow']); - my $netserver = '!myipfn!'; + + my $netserver; + if ($ent and $ent->{xcatmaster}) { + $netserver = $ent->{xcatmaster}; + } else { + $netserver = '!myipfn!'; + } if ($ent and $ent->{nfsserver}) { $netserver = $ent->{nfsserver}; diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 09861d560..fed757bab 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -73,22 +73,44 @@ sub setstate { my %chainhash = %{shift()}; my %machash = %{shift()}; my $tftpdir = shift; + my %nrhash = %{shift()}; my $kern = $bphash{$node}->[0]; #$bptab->getNodeAttribs($node,['kernel','initrd','kcmdline']); if ($kern->{kcmdline} =~ /!myipfn!/) { my $ipfn = xCAT::Utils->my_ip_facing($node); unless ($ipfn) { - my @myself = xCAT::Utils->determinehostname(); - my $myname = $myself[(scalar @myself)-1]; - $callback->( - { - error => [ - "$myname: Unable to determine the image server for $node" - ], - errorcode => [1] - } - ); + my $servicenodes = $nrhash{$node}->[0]; + if ($servicenodes and $servicenodes->{servicenode}) { + my @sns = split /,/, $servicenodes->{servicenode}; + foreach my $sn ( @sns ) { + # We are in the service node pools, print error if no facing ip. + if (xCAT::InstUtils->is_me($sn)) { + my @myself = xCAT::Utils->determinehostname(); + my $myname = $myself[(scalar @myself)-1]; + $callback->( + { + error => [ + "$myname: Unable to determine the image server for $node on service node $sn" + ], + errorcode => [1] + } + ); + return; + } + } + } else { + $callback->( + { + error => [ + "$myname: Unable to determine the image server for $node" + ], + errorcode => [1] + } + ); + return; + } + } else { + $kern->{kcmdline} =~ s/!myipfn!/$ipfn/g; } - $kern->{kcmdline} =~ s/!myipfn!/$ipfn/g; } if ($kern->{addkcmdline}) { $kern->{kcmdline} .= " ".$kern->{addkcmdline}; @@ -453,6 +475,8 @@ sub process_request { my $nodereshash=$noderestab->getNodesAttribs(\@nodes,['tftpdir']); my $mactab=xCAT::Table->new('mac',-create=>1); my $machash=$mactab->getNodesAttribs(\@nodes,['mac']); + my $nrtab=xCAT::Table->new('noderes',-create=>1); + my $nrhash=$nrtab->getNodesAttribs(\@nodes,['servicenode']); my $rc; my $errstr; @@ -469,7 +493,7 @@ sub process_request { $response{node}->[0]->{data}->[0]= getstate($_,$tftpdir); $callback->(\%response); } elsif ($args[0]) { #If anything else, send it on to the destiny plugin, then setstate - ($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir); + ($rc,$errstr) = setstate($_,$bphash,$chainhash,$machash,$tftpdir,$nrhash); if ($rc) { $response{node}->[0]->{errorcode}->[0]= $rc; $response{node}->[0]->{errorc}->[0]= $errstr;