2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-09-08 11:18:31 +00:00

Only set : port when non default

A case has been discovered where :80 seems to be asking for trouble.
Sidestep this case by omitting when it is not needed.
This commit is contained in:
Jarrod Johnson
2019-07-18 09:02:23 -04:00
parent e53b62e0cf
commit cd61fd9db4

View File

@@ -130,10 +130,10 @@ sub setstate {
my $imgaddkcmdline = $linuximghashref->{'addkcmdline'};
my $imgboottarget = $linuximghashref->{'boottarget'};
my $httpport="80";
my $httpport="";
my @hports=xCAT::TableUtils->get_site_attribute("httpport");
if ($hports[0]){
$httpport=$hports[0];
if ($hports[0] and $hports[0] ne "80"){
$httpport=":" . $hports[0];
}
# get kernel and initrd from boottarget table
@@ -271,8 +271,8 @@ sub setstate {
my $kernel;
($kernel, $hypervisor) = split /!/, $kern->{kernel};
print $pcfg " set 209:string xcat/xnba/nodes/$node.pxelinux\n";
print $pcfg " set 210:string http://" . '${next-server}'. ':' . $httpport . "/tftpboot/\n";
print $pcfg " imgfetch -n pxelinux.0 http://" . '${next-server}' . ':' . $httpport . "/tftpboot/xcat/pxelinux.0\n";
print $pcfg " set 210:string http://" . '${next-server}'. $httpport . "/tftpboot/\n";
print $pcfg " imgfetch -n pxelinux.0 http://" . '${next-server}' . $httpport . "/tftpboot/xcat/pxelinux.0\n";
print $pcfg " imgload pxelinux.0\n";
print $pcfg " imgexec pxelinux.0\n";
close($pcfg);
@@ -282,8 +282,8 @@ sub setstate {
} else {
if ($kern->{kernel} =~ /\.c32\z/ or $kern->{kernel} =~ /memdisk\z/) { #gPXE comboot support seems insufficient, chain pxelinux instead
print $pcfg " set 209:string xcat/xnba/nodes/$node.pxelinux\n";
print $pcfg " set 210:string http://" . '${next-server}' . ':' . $httpport . "/tftpboot/\n";
print $pcfg " imgfetch -n pxelinux.0 http://" . '${next-server}' . ':' . $httpport . "/tftpboot/xcat/pxelinux.0\n";
print $pcfg " set 210:string http://" . '${next-server}' . $httpport . "/tftpboot/\n";
print $pcfg " imgfetch -n pxelinux.0 http://" . '${next-server}' . $httpport . "/tftpboot/xcat/pxelinux.0\n";
print $pcfg " imgload pxelinux.0\n";
print $pcfg " imgexec pxelinux.0\n";
close($pcfg);
@@ -311,11 +311,11 @@ sub setstate {
$kern->{kcmdline} =~ s/xcat\/netboot/\/tftpboot\/xcat\/netboot/;
}
print $ucfg "#!gpxe\n";
print $ucfg 'chain http://${next-server}:'.$httpport.'/tftpboot/xcat/esxboot-x64.efi ' . $kern->{kcmdline} . "\n";
print $ucfg 'chain http://${next-server}'.$httpport.'/tftpboot/xcat/esxboot-x64.efi ' . $kern->{kcmdline} . "\n";
close($ucfg);
}
} else { #other than comboot/multiboot, we won't have need of pxelinux
print $pcfg "imgfetch -n kernel http://" . '${next-server}:' . $httpport.'/tftpboot/' . $kern->{kernel} . "\n";
print $pcfg "imgfetch -n kernel http://" . '${next-server}' . $httpport.'/tftpboot/' . $kern->{kernel} . "\n";
print $pcfg "imgload kernel\n";
if ($kern->{kcmdline}) {
print $pcfg "imgargs kernel " . $kern->{kcmdline} . ' BOOTIF=01-${netX/mac:hexhyp}' . "\n";
@@ -323,7 +323,7 @@ sub setstate {
print $pcfg "imgargs kernel BOOTIF=" . '${netX/mac}' . "\n";
}
if ($kern->{initrd}) {
print $pcfg "imgfetch -n initrd http://" . '${next-server}:' . "$httpport/tftpboot/" . $kern->{initrd} . "\n";
print $pcfg "imgfetch -n initrd http://" . '${next-server}' . "$httpport/tftpboot/" . $kern->{initrd} . "\n";
}
print $pcfg "imgexec kernel\n";
if ($kern->{kcmdline} and $kern->{initrd}) { #only a linux kernel/initrd pair should land here, write elilo config and uefi variant of xnba config file
@@ -331,18 +331,18 @@ sub setstate {
open($ucfg, '>', $tftpdir . "/xcat/xnba/nodes/" . $node . ".uefi");
if (has_efistub($kern->{kernel}, $node)) {
print $ucfg "#!gpxe\n";
print $ucfg "imgfetch -n kernel http://" . '${next-server}:' . $httpport.'/tftpboot/' . $kern->{kernel} . "\n";
print $ucfg "imgfetch -n kernel http://" . '${next-server}' . $httpport.'/tftpboot/' . $kern->{kernel} . "\n";
print $ucfg "imgload kernel\n";
if ($kern->{kcmdline}) {
print $ucfg "imgargs kernel " . $kern->{kcmdline} . ' BOOTIF=01-${netX/mac:hexhyp} initrd=initrd' . "\n";
} else {
print $ucfg "imgargs kernel BOOTIF=" . '${netX/mac} initrd=initrd' . "\n";
}
print $ucfg "imgfetch -n initrd http://" . '${next-server}:' . "$httpport/tftpboot/" . $kern->{initrd} . "\n";
print $ucfg "imgfetch -n initrd http://" . '${next-server}' . "$httpport/tftpboot/" . $kern->{initrd} . "\n";
print $ucfg "imgexec kernel\n";
close($ucfg);
} else {
print $ucfg 'chain http://${next-server}:'.$httpport.'/tftpboot/xcat/elilo-x64.efi -C /tftpboot/xcat/xnba/nodes/' . $node . ".elilo\n";
print $ucfg 'chain http://${next-server}'.$httpport.'/tftpboot/xcat/elilo-x64.efi -C /tftpboot/xcat/xnba/nodes/' . $node . ".elilo\n";
close($ucfg);
open($ucfg, '>', $tftpdir . "/xcat/xnba/nodes/" . $node . ".elilo");
print $ucfg 'default="xCAT"' . "\n";