diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index e6f759104..5099d9e4b 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -555,11 +555,32 @@ sub mknetboot $ient = $reshash->{$node}->[0]; $imgsrv = $xcatmaster; } + unless ($imgsrv) { xCAT::MsgUtils->report_node_error($callback, $node, "Unable to determine or reasonably guess the image server for $node"); next; } + my $imgsrvip; + unless($imgsrv eq '!myipfn!' or xCAT::NetworkUtils->validate_ip($imgsrv)==0){ + # if imgsrv is hostname, convert it to ip address + # the host name might not be resolved inside initrd + $imgsrvip = xCAT::NetworkUtils->getipaddr($imgsrv); + } + unless($imgsrvip){ + $imgsrvip=$imgsrv; + } + + my $xcatmasterip; + if (xCAT::NetworkUtils->validate_ip($xcatmaster)) { + # if xcatmaster is hostname, convert it to ip address + # the host name might not be resolved inside initrd + $xcatmasterip = xCAT::NetworkUtils->getipaddr($xcatmaster); + } + unless($xcatmasterip){ + $xcatmasterip=$xcatmaster + } + # Start to build kcmdline my $kcmdline; @@ -597,9 +618,9 @@ sub mknetboot } } else { if (-r "$rootimgdir/rootimg-statelite.gz.metainfo") { - $kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz.metainfo STATEMNT="; + $kcmdline = "imgurl=$httpmethod://$imgsrvip:$httpport/$rootimgdir/rootimg-statelite.gz.metainfo STATEMNT="; } else { - $kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT="; + $kcmdline = "imgurl=$httpmethod://$imgsrvip:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT="; } } @@ -626,21 +647,6 @@ sub mknetboot } } $kcmdline .= $statemnt . " "; - my $xcatmasterip; - - # if xcatmaster is hostname, convert it to ip address - if (xCAT::NetworkUtils->validate_ip($xcatmaster)) { - - # Using XCAT= will cause problems rc.statelite.ppc.redhat - # when trying to run chroot command - $xcatmasterip = xCAT::NetworkUtils->getipaddr($xcatmaster); - if (!$xcatmasterip) - { - $xcatmasterip = $xcatmaster; - } - } else { - $xcatmasterip = $xcatmaster; - } $kcmdline .= "XCAT=$xcatmasterip:$xcatdport "; @@ -669,11 +675,11 @@ sub mknetboot } else { if (-r "$rootimgdir/$compressedrootimg.metainfo") { - $kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/$compressedrootimg.metainfo "; + $kcmdline = "imgurl=$httpmethod://$imgsrvip:$httpport/$rootimgdir/$compressedrootimg.metainfo "; } else { - $kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/$compressedrootimg "; + $kcmdline = "imgurl=$httpmethod://$imgsrvip:$httpport/$rootimgdir/$compressedrootimg "; } - $kcmdline .= "XCAT=$xcatmaster:$xcatdport "; + $kcmdline .= "XCAT=$xcatmasterip:$xcatdport "; $kcmdline .= "NODE=$node "; # add flow control setting @@ -686,23 +692,10 @@ sub mknetboot } if (($::XCATSITEVALS{xcatdebugmode} eq "1") or ($::XCATSITEVALS{xcatdebugmode} eq "2")) { - - my ($host, $ipaddr) = xCAT::NetworkUtils->gethostnameandip($xcatmaster); - if ($ipaddr) { - - #for use in postscript and postbootscript in xcatdsklspost in the rootimg - $kcmdline .= " LOGSERVER=$ipaddr "; - - #for use in syslog dracut module in the initrd - $kcmdline .= " syslog.server=$ipaddr syslog.type=rsyslogd syslog.filter=*.* "; - } - else { - #for use in postscript and postbootscript in xcatdsklspost in the rootimg - $kcmdline .= " LOGSERVER=$xcatmaster "; - - #for use in syslog dracut module in the initrd - $kcmdline .= " syslog.server=$xcatmaster syslog.type=rsyslogd syslog.filter=*.* "; - } + #for use in postscript and postbootscript in xcatdsklspost in the rootimg + $kcmdline .= " LOGSERVER=$xcatmasterip "; + #for use in syslog dracut module in the initrd + $kcmdline .= " syslog.server=$xcatmasterip syslog.type=rsyslogd syslog.filter=*.* "; $kcmdline .= " xcatdebugmode=$::XCATSITEVALS{xcatdebugmode} "; }