mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 09:13:08 +00:00
Merge pull request #5757 from immarvin/onhttport
add support for site.httpport for post.xcat, updatenode, nodeset and makedhcp
This commit is contained in:
commit
c074db3e02
@ -652,7 +652,8 @@ sub mknetboot
|
||||
$kcmdline .= $statemnt . " ";
|
||||
|
||||
$kcmdline .= "XCAT=$xcatmasterip:$xcatdport ";
|
||||
|
||||
|
||||
$kcmdline .= "XCATHTTPPORT=$httpport ";
|
||||
|
||||
if ($rootfstype ne "ramdisk") {
|
||||
|
||||
|
@ -859,11 +859,17 @@ sub mkinstall {
|
||||
$instserver = '!myipfn!';
|
||||
}
|
||||
|
||||
my $httpport="80";
|
||||
my @hports=xCAT::TableUtils->get_site_attribute("httpport");
|
||||
if ($hports[0]){
|
||||
$httpport=$hports[0];
|
||||
}
|
||||
|
||||
if ($ent and $ent->{nfsserver}) {
|
||||
$instserver = $ent->{nfsserver};
|
||||
}
|
||||
|
||||
my $kcmdline = "nofb utf8 auto url=http://" . $instserver . "/install/autoinst/" . $node;
|
||||
my $kcmdline = "nofb utf8 auto url=http://" . $instserver . ":$httpport/install/autoinst/" . $node;
|
||||
|
||||
$kcmdline .= " xcatd=" . $instserver;
|
||||
$kcmdline .= " mirror/http/hostname=" . $instserver;
|
||||
@ -927,7 +933,7 @@ sub mkinstall {
|
||||
|
||||
#from 12.10, the live install changed, so add the live-installer
|
||||
if (-r "$pkgdir/install/filesystem.squashfs") {
|
||||
$kcmdline .= " live-installer/net-image=http://${instserver}${pkgdir}/install/filesystem.squashfs";
|
||||
$kcmdline .= " live-installer/net-image=http://${instserver}:$httpport${pkgdir}/install/filesystem.squashfs";
|
||||
}
|
||||
|
||||
xCAT::MsgUtils->trace($verbose_on_off, "d", "debian->mkinstall: kcmdline=$kcmdline kernal=$rtftppath/vmlinuz initrd=$rtftppath/initrd.img");
|
||||
@ -1326,11 +1332,11 @@ sub mknetboot
|
||||
$kcmdline = "NFSROOT=$nfssrv:$nfsdir STATEMNT=";
|
||||
}
|
||||
} else {
|
||||
$kcmdline = "imgurl=http://$imgsrv/$rootimgdir/rootimg-statelite.gz STATEMNT=";
|
||||
$kcmdline = "imgurl=http://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
|
||||
}
|
||||
|
||||
|
||||
|
||||
$kcmdline .=" XCATHTTPPORT=$httpport ";
|
||||
|
||||
# add support for subVars in the value of "statemnt"
|
||||
my $statemnt = "";
|
||||
@ -1384,10 +1390,11 @@ sub mknetboot
|
||||
else
|
||||
{
|
||||
$kcmdline =
|
||||
"imgurl=http://$imgsrv/$rootimgdir/$compressedrootimg ";
|
||||
"imgurl=http://$imgsrv:$httpport/$rootimgdir/$compressedrootimg ";
|
||||
$kcmdline .= "XCAT=$xcatmaster:$xcatdport ";
|
||||
}
|
||||
|
||||
|
||||
# if site.nodestatus='n', add "nonodestatus" to kcmdline to inform the node not to update nodestatus during provision
|
||||
if (($nodestatus eq "n") or ($nodestatus eq "N") or ($nodestatus eq "0")) {
|
||||
$kcmdline .= " nonodestatus ";
|
||||
|
@ -488,6 +488,12 @@ sub addnode
|
||||
my $ntent;
|
||||
my $tftpserver;
|
||||
|
||||
my $httpport="80";
|
||||
my @hports=xCAT::TableUtils->get_site_attribute("httpport");
|
||||
if ($hports[0]){
|
||||
$httpport=$hports[0];
|
||||
}
|
||||
|
||||
if ($chainents and $chainents->{$node}) {
|
||||
$chainent = $chainents->{$node}->[0];
|
||||
}
|
||||
@ -680,12 +686,12 @@ sub addnode
|
||||
if (proxydhcp($nrent)) { #proxy dhcp required in uefi invocation
|
||||
$lstatements = 'if option client-architecture = 00:00 or option client-architecture = 00:07 or option client-architecture = 00:09 { filename = \"\"; option vendor-class-identifier \"PXEClient\"; } else { filename = \"\"; }' . $lstatements; #If proxydhcp daemon is enable, use it.
|
||||
} else {
|
||||
$lstatements = 'if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { always-broadcast on; filename = \"http://' . $nxtsrv . '/tftpboot/xcat/xnba/nodes/' . $node . '\"; } else if option client-architecture = 00:07 or option client-architecture = 00:09 { filename = \"\"; option vendor-class-identifier \"PXEClient\"; } else if option client-architecture = 00:00 { filename = \"xcat/xnba.kpxe\"; } else { filename = \"\"; }' . $lstatements; #Only PXE compliant clients should ever receive xNBA
|
||||
$lstatements = 'if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { always-broadcast on; filename = \"http://' . $nxtsrv . ':' . $httpport . '/tftpboot/xcat/xnba/nodes/' . $node . '\"; } else if option client-architecture = 00:07 or option client-architecture = 00:09 { filename = \"\"; option vendor-class-identifier \"PXEClient\"; } else if option client-architecture = 00:00 { filename = \"xcat/xnba.kpxe\"; } else { filename = \"\"; }' . $lstatements; #Only PXE compliant clients should ever receive xNBA
|
||||
}
|
||||
} elsif ($douefi and $chainent->{currstate} ne "boot" and $chainent->{currstate} ne "iscsiboot") {
|
||||
$lstatements = 'if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { always-broadcast on; filename = \"http://' . $nxtsrv . '/tftpboot/xcat/xnba/nodes/' . $node . '\"; } else if option user-class-identifier = \"xNBA\" and option client-architecture = 00:09 { filename = \"http://' . $nxtsrv . '/tftpboot/xcat/xnba/nodes/' . $node . '.uefi\"; } else if option client-architecture = 00:07 { filename = \"xcat/xnba.efi\"; } else if option client-architecture = 00:00 { filename = \"xcat/xnba.kpxe\"; } else { filename = \"\"; }' . $lstatements; #Only PXE compliant clients should ever receive xNBA
|
||||
$lstatements = 'if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { always-broadcast on; filename = \"http://' . $nxtsrv . ':' . $httpport . '/tftpboot/xcat/xnba/nodes/' . $node . '\"; } else if option user-class-identifier = \"xNBA\" and option client-architecture = 00:09 { filename = \"http://' . $nxtsrv .':' . $httpport . '/tftpboot/xcat/xnba/nodes/' . $node . '.uefi\"; } else if option client-architecture = 00:07 { filename = \"xcat/xnba.efi\"; } else if option client-architecture = 00:00 { filename = \"xcat/xnba.kpxe\"; } else { filename = \"\"; }' . $lstatements; #Only PXE compliant clients should ever receive xNBA
|
||||
} else {
|
||||
$lstatements = 'if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { filename = \"http://' . $nxtsrv . '/tftpboot/xcat/xnba/nodes/' . $node . '\"; } else if option client-architecture = 00:00 { filename = \"xcat/xnba.kpxe\"; } else { filename = \"\"; }' . $lstatements; #Only PXE compliant clients should ever receive xNBA
|
||||
$lstatements = 'if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { filename = \"http://' . $nxtsrv .':' . $httpport . '/tftpboot/xcat/xnba/nodes/' . $node . '\"; } else if option client-architecture = 00:00 { filename = \"xcat/xnba.kpxe\"; } else { filename = \"\"; }' . $lstatements; #Only PXE compliant clients should ever receive xNBA
|
||||
}
|
||||
}
|
||||
} #TODO: warn when windows
|
||||
@ -702,7 +708,7 @@ sub addnode
|
||||
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'grub2') {
|
||||
$lstatements = 'filename = \"/boot/grub2/grub2-' . $node . '\";' . $lstatements;
|
||||
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'petitboot') {
|
||||
$lstatements = 'option conf-file \"http://' . $nxtsrv . '/tftpboot/petitboot/' . $node . '\";' . $lstatements;
|
||||
$lstatements = 'option conf-file \"http://' . $nxtsrv .':' . $httpport . '/tftpboot/petitboot/' . $node . '\";' . $lstatements;
|
||||
} elsif ($nrent and $nrent->{netboot} and $nrent->{netboot} eq 'onie') {
|
||||
my $provmethod = $ntent->{provmethod};
|
||||
if ($provmethod) {
|
||||
@ -714,7 +720,7 @@ sub addnode
|
||||
my $validpkgdir;
|
||||
foreach my $mypkgdir (@pkgdirs){
|
||||
if (-f $mypkgdir) {
|
||||
$lstatements = 'if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { option www-server = \"http://' . $nxtsrv . $mypkgdir . '\";}' . $lstatements;
|
||||
$lstatements = 'if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { option www-server = \"http://' . $nxtsrv .':' . $httpport . $mypkgdir . '\";}' . $lstatements;
|
||||
$validpkgdir = 1;
|
||||
last;
|
||||
}
|
||||
@ -2383,6 +2389,11 @@ sub addnet
|
||||
my $mask = shift;
|
||||
my $nic;
|
||||
my $domain;
|
||||
my $httpport="80";
|
||||
my @hports=xCAT::TableUtils->get_site_attribute("httpport");
|
||||
if ($hports[0]){
|
||||
$httpport=$hports[0];
|
||||
}
|
||||
my $firstoctet = $net;
|
||||
$firstoctet =~ s/^(\d+)\..*/$1/;
|
||||
if ($net eq "169.254.0.0" or ($firstoctet >= 224 and $firstoctet <= 239)) {
|
||||
@ -2666,7 +2677,7 @@ sub addnet
|
||||
}
|
||||
}
|
||||
#for cumulus ZTP process
|
||||
push @netent, " option cumulus-provision-url \"http://$tftp/install/postscripts/cumulusztp\";\n";
|
||||
push @netent, " option cumulus-provision-url \"http://$tftp.':' . $httpport/install/postscripts/cumulusztp\";\n";
|
||||
|
||||
my $ddnserver = $nameservers;
|
||||
$ddnserver =~ s/,.*//;
|
||||
@ -2706,9 +2717,9 @@ sub addnet
|
||||
# $lstatements = 'if exists gpxe.bus-id { filename = \"\"; } else if exists client-architecture { filename = \"xcat/xnba.kpxe\"; } '.$lstatements;
|
||||
push @netent, " if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { #x86, xCAT Network Boot Agent\n";
|
||||
push @netent, " always-broadcast on;\n";
|
||||
push @netent, " filename = \"http://$tftp/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . "\";\n";
|
||||
push @netent, " filename = \"http://$tftp.':' . $httpport/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . "\";\n";
|
||||
push @netent, " } else if option user-class-identifier = \"xNBA\" and option client-architecture = 00:09 { #x86, xCAT Network Boot Agent\n";
|
||||
push @netent, " filename = \"http://$tftp/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . ".uefi\";\n";
|
||||
push @netent, " filename = \"http://$tftp.':' . $httpport/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . ".uefi\";\n";
|
||||
push @netent, " } else if option client-architecture = 00:00 { #x86\n";
|
||||
push @netent, " filename \"xcat/xnba.kpxe\";\n";
|
||||
push @netent, " } else if option vendor-class-identifier = \"Etherboot-5.4\" { #x86\n";
|
||||
@ -2724,10 +2735,10 @@ sub addnet
|
||||
push @netent, " filename \"elilo.efi\";\n";
|
||||
push @netent,
|
||||
" } else if option client-architecture = 00:0e { #OPAL-v3\n ";
|
||||
push @netent, " option conf-file = \"http://$tftp/tftpboot/pxelinux.cfg/p/" . $net . "_" . $maskbits . "\";\n";
|
||||
push @netent, " option conf-file = \"http://$tftp.':' . $httpport/tftpboot/pxelinux.cfg/p/" . $net . "_" . $maskbits . "\";\n";
|
||||
push @netent,
|
||||
" } else if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { #for onie on cumulus switch\n";
|
||||
push @netent, " option www-server = \"http://$tftp/install/onie/onie-installer\";\n";
|
||||
push @netent, " option www-server = \"http://$tftp.':' . $httpport/install/onie/onie-installer\";\n";
|
||||
push @netent,
|
||||
" } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n ";
|
||||
push @netent, " filename \"/yaboot\";\n";
|
||||
|
@ -46,6 +46,12 @@ sub process_request {
|
||||
$xcatdport = $t_entry;
|
||||
}
|
||||
|
||||
my $httpport="80";
|
||||
my @hports=xCAT::TableUtils->get_site_attribute("httpport");
|
||||
if ($hports[0]){
|
||||
$httpport=$hports[0];
|
||||
}
|
||||
|
||||
@entries = xCAT::TableUtils->get_site_attribute("dhcpinterfaces");
|
||||
$t_entry = $entries[0];
|
||||
if (defined($t_entry)) {
|
||||
@ -289,15 +295,15 @@ sub process_request {
|
||||
open($cfg, ">", "$tftpdir/xcat/xnba/nets/$net");
|
||||
print $cfg "#!gpxe\n";
|
||||
if ($invisibletouch) {
|
||||
print $cfg 'imgfetch -n kernel http://${next-server}/tftpboot/xcat/genesis.kernel.' . "$arch quiet xcatd=" . $normnets->{$_} . ":$xcatdport $consolecmdline BOOTIF=01-" . '${netX/machyp}' . "\n";
|
||||
print $cfg 'imgfetch -n kernel http://${next-server}:'.$httpport.'/tftpboot/xcat/genesis.kernel.' . "$arch quiet xcatd=" . $normnets->{$_} . ":$xcatdport $consolecmdline BOOTIF=01-" . '${netX/machyp}' . "\n";
|
||||
if ($lzma_exit_value) {
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/genesis.fs.' . "$arch.gz\n";
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}:'.$httpport.'/tftpboot/xcat/genesis.fs.' . "$arch.gz\n";
|
||||
} else {
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/genesis.fs.' . "$arch.lzma\n";
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}:'.$httpport.'/tftpboot/xcat/genesis.fs.' . "$arch.lzma\n";
|
||||
}
|
||||
} else {
|
||||
print $cfg 'imgfetch -n kernel http://${next-server}/tftpboot/xcat/nbk.' . "$arch quiet xcatd=" . $normnets->{$_} . ":$xcatdport $consolecmdline\n";
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}/tftpboot/xcat/nbfs.' . "$arch.gz\n";
|
||||
print $cfg 'imgfetch -n kernel http://${next-server}:'.$httpport.'/tftpboot/xcat/nbk.' . "$arch quiet xcatd=" . $normnets->{$_} . ":$xcatdport $consolecmdline\n";
|
||||
print $cfg 'imgfetch -n nbfs http://${next-server}:'.$httpport.'/tftpboot/xcat/nbfs.' . "$arch.gz\n";
|
||||
}
|
||||
print $cfg "imgload kernel\n";
|
||||
print $cfg "imgexec kernel\n";
|
||||
@ -317,7 +323,7 @@ sub process_request {
|
||||
close($cfg);
|
||||
open($cfg, ">", "$tftpdir/xcat/xnba/nets/$net.uefi");
|
||||
print $cfg "#!gpxe\n";
|
||||
print $cfg 'chain http://${next-server}/tftpboot/xcat/elilo-x64.efi -C /tftpboot/xcat/xnba/nets/' . "$net.elilo\n";
|
||||
print $cfg 'chain http://${next-server}:'.$httpport.'/tftpboot/xcat/elilo-x64.efi -C /tftpboot/xcat/xnba/nets/' . "$net.elilo\n";
|
||||
close($cfg);
|
||||
}
|
||||
} elsif ($arch =~ /ppc/) {
|
||||
@ -325,8 +331,8 @@ sub process_request {
|
||||
print $cfgfile "default \"xCAT Genesis (" . $normnets->{$_} . ")\"\n";
|
||||
print $cfgfile " delay=10\n";
|
||||
print $cfgfile " label \"xCAT Genesis (" . $normnets->{$_} . ")\"\n";
|
||||
print $cfgfile " kernel http://" . $normnets->{$_} . ":80/$tftpdir/xcat/genesis.kernel.$arch\n";
|
||||
print $cfgfile " initrd http://" . $normnets->{$_} . ":80/$initrd_file\n";
|
||||
print $cfgfile " kernel http://" . $normnets->{$_} . ":$httpport/$tftpdir/xcat/genesis.kernel.$arch\n";
|
||||
print $cfgfile " initrd http://" . $normnets->{$_} . ":$httpport/$initrd_file\n";
|
||||
print $cfgfile ' append "quiet xcatd=' . $normnets->{$_} . ":$xcatdport $consolecmdline\"\n";
|
||||
close($cfgfile);
|
||||
}
|
||||
@ -363,8 +369,8 @@ sub process_request {
|
||||
print $cfgfile "default \"xCAT Genesis (" . $normnets->{$_} . ")\"\n";
|
||||
print $cfgfile " delay=10\n";
|
||||
print $cfgfile " label \"xCAT Genesis (" . $normnets->{$_} . ")\"\n";
|
||||
print $cfgfile " kernel http://" . $hexnets->{$_} . ":80/$tftpdir/xcat/genesis.kernel.$arch\n";
|
||||
print $cfgfile " initrd http://" . $hexnets->{$_} . ":80/$initrd_file\n";
|
||||
print $cfgfile " kernel http://" . $hexnets->{$_} . ":$httpport/$tftpdir/xcat/genesis.kernel.$arch\n";
|
||||
print $cfgfile " initrd http://" . $hexnets->{$_} . ":$httpport/$initrd_file\n";
|
||||
print $cfgfile ' append "quiet xcatd=' . $hexnets->{$_} . ":$xcatdport $consolecmdline\"\n";
|
||||
close($cfgfile);
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ sub mknetboot
|
||||
$kcmdline = "NFSROOT=$nfssrv:$nfsdir STATEMNT=";
|
||||
}
|
||||
} else {
|
||||
$kcmdline = "imgurl=$httpmethod://$imgsrv/$rootimgdir/rootimg-statelite.gz STATEMNT=";
|
||||
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
|
||||
}
|
||||
|
||||
# add support for subVars in the value of "statemnt"
|
||||
@ -512,9 +512,10 @@ sub mknetboot
|
||||
else
|
||||
{
|
||||
$kcmdline =
|
||||
"imgurl=$httpmethod://$imgsrv/$rootimgdir/$compressedrootimg ";
|
||||
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/$compressedrootimg ";
|
||||
}
|
||||
$kcmdline .= "XCAT=$xcatmaster:$xcatdport quiet ";
|
||||
$kcmdline .= " XCATHTTPPORT=$httpport ";
|
||||
|
||||
#if site.nodestatus="n", append "nonodestatus" to kcmdline
|
||||
#to inform the statelite/stateless node not to update the nodestatus during provision
|
||||
|
@ -1564,6 +1564,11 @@ sub updatenoderunps
|
||||
if ($fc[0] && ($fc[0] =~ /1|Yes|yes|YES|Y|y/)) {
|
||||
$flowcontrol = 1;
|
||||
}
|
||||
my $httpport="80";
|
||||
my @hports=xCAT::TableUtils->get_site_attribute("httpport");
|
||||
if ($hports[0]){
|
||||
$httpport=$hports[0];
|
||||
}
|
||||
|
||||
# if running postscript report status here, if requested.
|
||||
if ((defined($request->{status})) && ($request->{status} eq "yes")) {
|
||||
@ -1625,10 +1630,10 @@ sub updatenoderunps
|
||||
|
||||
if ($::SETSERVER) { # update the xcatinfo file on the node and run setuppostbootscripts
|
||||
$runpscmd =
|
||||
"$installdir/postscripts/xcatdsklspost $mode -M $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c";
|
||||
"$installdir/postscripts/xcatdsklspost $mode -M $snkey:$httpport '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c";
|
||||
} else {
|
||||
$runpscmd =
|
||||
"$installdir/postscripts/xcatdsklspost $mode -m $snkey '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c"
|
||||
"$installdir/postscripts/xcatdsklspost $mode -m $snkey:$httpport '$postscripts' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c"
|
||||
}
|
||||
|
||||
# add flowcontrol flag
|
||||
@ -2084,6 +2089,12 @@ sub updatenodesoftware
|
||||
$flowcontrol = 1;
|
||||
}
|
||||
|
||||
my $httpport="80";
|
||||
my @hports=xCAT::TableUtils->get_site_attribute("httpport");
|
||||
if ($hports[0]){
|
||||
$httpport=$hports[0];
|
||||
}
|
||||
|
||||
# this drives getdata to report status complete for software updatees
|
||||
$::TYPECALL = "S";
|
||||
|
||||
@ -2117,7 +2128,7 @@ sub updatenodesoftware
|
||||
my $cmd;
|
||||
my $args1;
|
||||
$cmd =
|
||||
"$installdir/postscripts/xcatdsklspost 2 -m $snkey 'ospkgs,otherpkgs,syscloneimgupdate' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c";
|
||||
"$installdir/postscripts/xcatdsklspost 2 -m $snkey:$httpport 'ospkgs,otherpkgs,syscloneimgupdate' --tftp $tftpdir --installdir $installdir --nfsv4 $nfsv4 -c";
|
||||
|
||||
# add flowcontrol flag
|
||||
if ($flowcontrol == 1) {
|
||||
@ -3301,6 +3312,12 @@ sub updateOS
|
||||
# Get install directory
|
||||
my $installDIR = xCAT::TableUtils->getInstallDir();
|
||||
|
||||
my $httpport="80";
|
||||
my @hports=xCAT::TableUtils->get_site_attribute("httpport");
|
||||
if ($hports[0]){
|
||||
$httpport=$hports[0];
|
||||
}
|
||||
|
||||
# Get HTTP server
|
||||
my $http;
|
||||
my @httpd = xCAT::NetworkUtils->my_ip_facing($node);
|
||||
@ -3372,7 +3389,7 @@ sub updateOS
|
||||
{
|
||||
|
||||
# SUSE repository path - http://10.1.100.1/install/sles10.3/s390x/1/
|
||||
$path = "http://$http$installDIR/$os/$arch/1/";
|
||||
$path = "http://$http:$httpport$installDIR/$os/$arch/1/";
|
||||
if (!(-e "$installDIR/$os/$arch/1/"))
|
||||
{
|
||||
push @{ $rsp->{data} },
|
||||
@ -3406,7 +3423,7 @@ sub updateOS
|
||||
{
|
||||
|
||||
# SUSE repository path - http://10.1.100.1/install/sles10.3/s390x/1/
|
||||
$path = "http://$http$installDIR/$os/$arch/1/";
|
||||
$path = "http://$http$httpport$installDIR/$os/$arch/1/";
|
||||
if (!(-e "$installDIR/$os/$arch/1/"))
|
||||
{
|
||||
push @{ $rsp->{data} },
|
||||
@ -3438,7 +3455,7 @@ sub updateOS
|
||||
my $verifyOS = $os;
|
||||
$verifyOS =~ s/^\D+([\d.]+)$/$1/;
|
||||
if (xCAT::Utils->version_cmp($verifyOS, "7.0") < 0) {
|
||||
$path = "http://$http$installDIR/$os/$arch/Server/";
|
||||
$path = "http://$http:$httpport$installDIR/$os/$arch/Server/";
|
||||
if (!(-e "$installDIR/$os/$arch/Server/"))
|
||||
{
|
||||
push @{ $rsp->{data} },
|
||||
@ -3449,7 +3466,7 @@ sub updateOS
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = "http://$http$installDIR/$os/$arch/";
|
||||
$path = "http://$http:$httpport$installDIR/$os/$arch/";
|
||||
if (!(-e "$installDIR/$os/$arch/"))
|
||||
{
|
||||
push @{ $rsp->{data} },
|
||||
|
@ -111,6 +111,12 @@ sub setstate {
|
||||
my $imgaddkcmdline = $linuximghashref->{'addkcmdline'};
|
||||
my $imgboottarget = $linuximghashref->{'boottarget'};
|
||||
|
||||
my $httpport="80";
|
||||
my @hports=xCAT::TableUtils->get_site_attribute("httpport");
|
||||
if ($hports[0]){
|
||||
$httpport=$hports[0];
|
||||
}
|
||||
|
||||
# get kernel and initrd from boottarget table
|
||||
my $bttab;
|
||||
my $btentry;
|
||||
@ -246,8 +252,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}' . "/tftpboot/\n";
|
||||
print $pcfg " imgfetch -n pxelinux.0 http://" . '${next-server}' . "/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);
|
||||
@ -257,8 +263,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}' . "/tftpboot/\n";
|
||||
print $pcfg " imgfetch -n pxelinux.0 http://" . '${next-server}' . "/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);
|
||||
@ -286,11 +292,11 @@ sub setstate {
|
||||
$kern->{kcmdline} =~ s/xcat\/netboot/\/tftpboot\/xcat\/netboot/;
|
||||
}
|
||||
print $ucfg "#!gpxe\n";
|
||||
print $ucfg 'chain http://${next-server}/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}/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/machyp}' . "\n";
|
||||
@ -298,14 +304,14 @@ sub setstate {
|
||||
print $pcfg "imgargs kernel BOOTIF=" . '${netX/mac}' . "\n";
|
||||
}
|
||||
if ($kern->{initrd}) {
|
||||
print $pcfg "imgfetch http://" . '${next-server}' . "/tftpboot/" . $kern->{initrd} . "\n";
|
||||
print $pcfg "imgfetch 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
|
||||
my $ucfg;
|
||||
open($ucfg, '>', $tftpdir . "/xcat/xnba/nodes/" . $node . ".uefi");
|
||||
print $ucfg "#!gpxe\n";
|
||||
print $ucfg 'chain http://${next-server}/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";
|
||||
|
@ -34,9 +34,13 @@ export MASTER_IP="#XCATVAR:XCATMASTER#"
|
||||
export MASTER_IPS="#XCATVAR:XCATMASTER#"
|
||||
export MASTER="#XCATVAR:XCATMASTER#"
|
||||
export INSTALLDIR=#TABLE:site:key=installdir:value#
|
||||
export HTTPPORT=#TABLE:site:key=httpport:value#
|
||||
if [ -z "$INSTALLDIR" ]; then
|
||||
INSTALLDIR="/install"
|
||||
fi
|
||||
if [ -z "$HTTPPORT" ]; then
|
||||
HTTPPORT="80"
|
||||
fi
|
||||
cd /tmp
|
||||
RAND=$(perl -e 'print int(rand(50)). "\n"')
|
||||
sleep $RAND
|
||||
@ -45,7 +49,7 @@ do
|
||||
GOTIT=0
|
||||
for i in $MASTER_IPS
|
||||
do
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -e robots=off -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 0 -T 60 http://$i$INSTALLDIR/postscripts/ -P /xcatpost
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -e robots=off -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 0 -T 60 http://${i}:${HTTPPORT}${INSTALLDIR}/postscripts/ -P /xcatpost
|
||||
#wget --wait=10 --random-wait --waitretry=10 --retry-connrefused -t 0 -T 60 http://$i/install/autoinst/xcatpost.tar.gz
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
@ -95,6 +99,14 @@ do
|
||||
else
|
||||
echo "XCATSERVER=$i" >> /opt/xcat/xcatinfo
|
||||
fi
|
||||
|
||||
grep 'HTTPPORT' /opt/xcat/xcatinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
sed -i "s/HTTPPORT=.*/HTTPPORT=$HTTPPORT/" /opt/xcat/xcatinfo
|
||||
else
|
||||
echo "HTTPPORT=$HTTPPORT" >> /opt/xcat/xcatinfo
|
||||
fi
|
||||
|
||||
break
|
||||
fi
|
||||
RAND=$(perl -e 'print int(rand(5)). "\n"')
|
||||
|
@ -8,6 +8,7 @@ export XCATIPORT=#TABLE:site:key=xcatiport:value#
|
||||
export INSTALLDIR=#TABLE:site:key=installdir:value#
|
||||
export TFTPDIR=#TABLE:site:key=tftpdir:value#
|
||||
export XCATDEBUGMODE="#TABLEBLANKOKAY:site:key=xcatdebugmode:value#"
|
||||
export HTTPPORT="#TABLE:site:key=httpport:value#"
|
||||
|
||||
#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/scriptlib#
|
||||
|
||||
@ -27,6 +28,9 @@ fi
|
||||
if [[ $TFTPDIR != /* ]]; then
|
||||
TFTPDIR="/"$TFTPDIR
|
||||
fi
|
||||
if [ -z "$HTTPPORT" ]; then
|
||||
HTTPPORT="80"
|
||||
fi
|
||||
|
||||
NODESTATUS=$(echo "$NODESTATUS"| tr -d \'\"| tr A-Z a-z)
|
||||
|
||||
@ -75,6 +79,13 @@ else
|
||||
echo "INSTALLDIR=$INSTALLDIR" >> /opt/xcat/xcatinfo
|
||||
fi
|
||||
|
||||
grep 'HTTPPORT' /opt/xcat/xcatinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
sed -i "s/HTTPPORT=.*/HTTPPORT=$HTTPPORT/" /opt/xcat/xcatinfo
|
||||
else
|
||||
echo "HTTPPORT=$HTTPPORT" >> /opt/xcat/xcatinfo
|
||||
fi
|
||||
|
||||
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
|
||||
msgutil_r "$MASTER_IP" "debug" "/opt/xcat/xcatinfo generated" "/var/log/xcat/xcat.log" "$log_label"
|
||||
fi
|
||||
@ -89,7 +100,7 @@ if [ ! -x /usr/bin/wget ]; then
|
||||
sleep 36500d
|
||||
fi
|
||||
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -e robots=off -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 20 -T 60 http://$MASTER_IP$INSTALLDIR/postscripts/ -P /xcatpost 2> /tmp/wget.log
|
||||
wget -l inf -N -r --waitretry=10 --random-wait --retry-connrefused -e robots=off -nH --cut-dirs=2 --reject "index.html*" --no-parent -t 20 -T 60 http://${MASTER_IP}:${HTTPPORT}${INSTALLDIR}/postscripts/ -P /xcatpost 2> /tmp/wget.log
|
||||
if [ "$?" != "0" ]; then
|
||||
msgutil_r "$MASTER_IP" "error" "failed to download postscripts from http://$MASTER_IP$INSTALLDIR/postscripts/,check /tmp/wget.log on the node, halt ..." "/var/log/xcat/xcat.log" "$log_label"
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus failed"
|
||||
@ -106,7 +117,7 @@ export NODE=#TABLE:nodelist:THISNODE:node#
|
||||
|
||||
msgutil_r "$MASTER_IP" "info" "trying to get mypostscript from $MASTER_IP..." "/var/log/xcat/xcat.log" "$log_label"
|
||||
|
||||
wget -N --waitretry=10 --random-wait --retry-connrefused -t 20 -T 60 http://$MASTER_IP$TFTPDIR/mypostscripts/mypostscript.$NODE -P /xcatpost 2> /tmp/wget.log
|
||||
wget -N --waitretry=10 --random-wait --retry-connrefused -t 20 -T 60 http://${MASTER_IP}:${HTTPPORT}${TFTPDIR}/mypostscripts/mypostscript.$NODE -P /xcatpost 2> /tmp/wget.log
|
||||
if [ "$?" = "0" ]; then
|
||||
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
|
||||
msgutil_r "$MASTER_IP" "debug" "precreated mypostscript downloaded successfully" "/var/log/xcat/xcat.log" "$log_label"
|
||||
|
@ -210,6 +210,30 @@ pmatch ()
|
||||
|
||||
return 1 # non-zero return code means string not matched by pattern
|
||||
}
|
||||
|
||||
#parse the http server "<ip/hostname>:<port>"
|
||||
#usgae: parsehttpserver(<http server string>,<what to return? 'server' or 'port'>)
|
||||
parsehttpserver ()
|
||||
{
|
||||
rawserver=$1
|
||||
option=$2
|
||||
server=$(echo "$rawserver"|cut -d: -f1 -s 2>/dev/null)
|
||||
port="80"
|
||||
if [ -z "$server" ];then
|
||||
server=$rawserver
|
||||
else
|
||||
port=$(echo "$rawserver"|cut -d: -f2 -s 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ "$option" = "server" ];then
|
||||
return $server
|
||||
fi
|
||||
|
||||
if [ "$option" = "port" ];then
|
||||
return $port
|
||||
fi
|
||||
}
|
||||
|
||||
# Main
|
||||
# parse the arguments
|
||||
ARGNUM=$#;
|
||||
@ -226,10 +250,14 @@ else
|
||||
MODE=$1
|
||||
if [ $ARGNUM -gt 1 ]; then
|
||||
if [ $2 = "-m" ]; then
|
||||
P_SIP=$3
|
||||
P_SVR=$3
|
||||
P_SIP=parsehttpserver "$P_SVR" 'server'
|
||||
HTTPPORT=parsehttpserver "$P_SVR" 'port'
|
||||
else
|
||||
if [ $2 = "-M" ]; then
|
||||
P_SIP=$3
|
||||
P_SVR=$3
|
||||
P_SIP=parsehttpserver "$P_SVR" 'server'
|
||||
HTTPPORT=parsehttpserver "$P_SVR" 'port'
|
||||
new_ms=$P_SIP # -M means we will update xcatinfo file XCATSERVER
|
||||
fi
|
||||
fi
|
||||
@ -348,13 +376,24 @@ if [ "$MODE" = "4" ]; then # for statelite mode
|
||||
echo "XCATSERVER=$XCATSERVER" >> /opt/xcat/xcatinfo
|
||||
fi
|
||||
break
|
||||
elif [ "$KEY" = "XCATHTTPPORT" ]; then
|
||||
HTTPPORT=`echo $i | awk -F= '{print $2}'`
|
||||
grep 'HTTPPORT' /opt/xcat/xcatinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
sed -i "s/HTTPPORT=.*/HTTPPORT=$HTTPPORT/" /opt/xcat/xcatinfo
|
||||
else
|
||||
echo "HTTPPORT=$HTTPPORT" >> /opt/xcat/xcatinfo
|
||||
fi
|
||||
break
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -f /opt/xcat/xcatinfo ]; then
|
||||
SIP=`grep 'XCATSERVER' /opt/xcat/xcatinfo |cut -d= -f2`
|
||||
HTTPPORT=`grep 'HTTPPORT' /opt/xcat/xcatinfo |cut -d= -f2`
|
||||
if [ -n "$SIP" ]; then
|
||||
download_postscripts $SIP
|
||||
download_postscripts $SIP:${HTTPPORT}
|
||||
if [ $? -eq 0 ]; then
|
||||
downloaded=1
|
||||
fi
|
||||
@ -395,7 +434,7 @@ else # for common mode MODE=1,2,3,5 (updatenode,moncfg,node deployment)
|
||||
# also update the XCATSERVER in the /etc/xcat/xcatinfo file with this
|
||||
# address
|
||||
if [ -n "$P_SIP" ]; then # passed in with updatenode on -M/-m
|
||||
SIP=$P_SIP
|
||||
SIP="${P_SIP}:${HTTPPORT}"
|
||||
download_postscripts $SIP
|
||||
if [ $? -eq 0 ]; then
|
||||
downloaded=1
|
||||
@ -420,8 +459,10 @@ else # for common mode MODE=1,2,3,5 (updatenode,moncfg,node deployment)
|
||||
# if not updatenode, then look in xcatinfo for the xcatmaster
|
||||
if [ -f /opt/xcat/xcatinfo ]; then
|
||||
SIP=`grep 'XCATSERVER' /opt/xcat/xcatinfo |cut -d= -f2`
|
||||
HTTPPORT=`grep 'HTTPPORT' /opt/xcat/xcatinfo |cut -d= -f2`
|
||||
[ -z "$HTTPPORT" ] && HTTPPORT="80"
|
||||
if [ -n "$SIP" ]; then
|
||||
download_postscripts $SIP
|
||||
download_postscripts ${SIP}:${HTTPPORT}
|
||||
if [ $? -eq 0 ]; then
|
||||
downloaded=1
|
||||
fi
|
||||
@ -438,15 +479,20 @@ else # for common mode MODE=1,2,3,5 (updatenode,moncfg,node deployment)
|
||||
if [ "$KEY" = "XCAT" ]; then
|
||||
TMP=`echo $i | awk -F= '{print $2}'`
|
||||
SIP=`echo $TMP | cut -d: -f1`
|
||||
if [ -n "$SIP" ]; then
|
||||
download_postscripts $SIP
|
||||
if [ $? -eq 0 ]; then
|
||||
downloaded=1
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
elif [ "$KEY" = "XCATHTTPPORT" ];then
|
||||
HTTPPORT=$(echo $i | awk -F= '{print $1}')
|
||||
[ -z "$HTTPPORT" ] && HTTPPORT="80"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$SIP" ]; then
|
||||
download_postscripts "${SIP}:${HTTPPORT}"
|
||||
if [ $? -eq 0 ]; then
|
||||
downloaded=1
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# download poscripts has not worked yet
|
||||
@ -549,11 +595,11 @@ echolog "info" "trying to get mypostscript from $SIP..."
|
||||
max_retries=2
|
||||
# try short hostname first
|
||||
if [ -n "$node_short" ]; then
|
||||
download_mypostscript $SIP $node_short $max_retries $TFTPDIR
|
||||
download_mypostscript "${SIP}:${HTTPPORT}" $node_short $max_retries $TFTPDIR
|
||||
if [ $? -ne 0 ]; then
|
||||
# try long hostname
|
||||
if [ "$node" != "$node_short" ]; then
|
||||
download_mypostscript $SIP $node $postfix $max_retries $TFTPDIR
|
||||
download_mypostscript "${SIP}:${HTTPPORT}" $node $postfix $max_retries $TFTPDIR
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -661,6 +707,13 @@ if [ -n "$new_ms" ]; then
|
||||
else
|
||||
echo "XCATSERVER=$new_ms" >> /opt/xcat/xcatinfo
|
||||
fi
|
||||
|
||||
grep 'HTTPPORT' /opt/xcat/xcatinfo > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
sed -i "s/HTTPPORT=.*/HTTPPORT=$HTTPPORT/" /opt/xcat/xcatinfo
|
||||
else
|
||||
echo "HTTPPORT=$HTTPPORT" >> /opt/xcat/xcatinfo
|
||||
fi
|
||||
fi
|
||||
|
||||
#save the USEFLOWCONTROL into the xcatinfo file
|
||||
|
Loading…
x
Reference in New Issue
Block a user