2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-21 19:22:05 +00:00
* fix issue Compute nodes fail to get provisioned #4411: covert imgsrv and xcatmaster to their ip addresses in case the hostname cannot be resolved inside initrd for diskless
This commit is contained in:
yangsong 2017-12-07 00:50:34 -06:00 committed by Bin Xu
parent 51c609846f
commit 7cc62be2b0

View File

@ -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=<hostname> 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} ";
}