From a180201e24c36c532c45b1114e23c4dac3e878cc Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 28 May 2013 12:20:12 +0000 Subject: [PATCH] add NODE= to kcmdline git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@16428 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/anaconda.pm | 6 +- xCAT-server/lib/xcat/plugins/anaconda.pm.new | 97 ++++++++++---------- xCAT-server/lib/xcat/plugins/debian.pm | 2 + xCAT-server/lib/xcat/plugins/sles.pm | 1 + 4 files changed, 54 insertions(+), 52 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 40cba3c68..046400d05 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -608,7 +608,9 @@ sub mknetboot ); next; } - my $kcmdline; # add two more arguments: XCAT=xcatmaster:xcatport and ifname=: + my $kcmdline; + # add more arguments: XCAT=xcatmaster:xcatport NODE= + #and ifname=: if($statelite){ if ($rootfstype ne "ramdisk") { # get entry for nfs root if it exists: @@ -700,6 +702,7 @@ sub mknetboot $kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix "; $kcmdline .= "XCAT=$xcatmaster:$xcatdport "; + $kcmdline .= "NODE=$node "; } # add one parameter: ifname=: @@ -1802,7 +1805,6 @@ sub mksysclone $kcmdline .= "n8r"; } } - $kcmdline .= " xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename"; #$kcmdline .= " noipv6"; # add the addkcmdline attribute to the end diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm.new b/xCAT-server/lib/xcat/plugins/anaconda.pm.new index e46e399bf..046400d05 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm.new +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm.new @@ -38,10 +38,10 @@ sub handled_commands { return { copycd => "anaconda", - mknetboot => "nodetype:os=(ol.*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)", - mkinstall => "nodetype:os=(esxi4.1)|(esx[34].*)|(ol.*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)", - mksysclone => "nodetype:os=(esxi4.1)|(esx[34].*)|(ol.*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)", - mkstatelite => "nodetype:os=(esx[34].*)|(ol.*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)", + mknetboot => "nodetype:os=(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)", + mkinstall => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)", + mksysclone => "nodetype:os=(esxi4.1)|(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh(?!evh).*)|(fedora.*)|(SL.*)", + mkstatelite => "nodetype:os=(esx[34].*)|(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)", }; } @@ -485,7 +485,6 @@ sub mknetboot # create the node-specific post scripts #mkpath "/install/postscripts/"; - #xCAT::Postage->writescript($node,"/install/postscripts/".$node, "netboot", $callback); # Copy the boot resource to /tftpboot and check to only copy once my $docopy = 0; @@ -609,7 +608,9 @@ sub mknetboot ); next; } - my $kcmdline; # add two more arguments: XCAT=xcatmaster:xcatport and ifname=: + my $kcmdline; + # add more arguments: XCAT=xcatmaster:xcatport NODE= + #and ifname=: if($statelite){ if ($rootfstype ne "ramdisk") { # get entry for nfs root if it exists: @@ -701,6 +702,7 @@ sub mknetboot $kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix "; $kcmdline .= "XCAT=$xcatmaster:$xcatdport "; + $kcmdline .= "NODE=$node "; } # add one parameter: ifname=: @@ -842,7 +844,11 @@ sub mknetboot # add the cmdline parameters for handling the local disk for stateless if ($cfgpart eq "yes") { - $kcmdline .= " PARTITION"; + if ($statelite) { + $kcmdline .= " PARTITION_RH" + } else { + $kcmdline .= " PARTITION_DOMOUNT_RH" + } } # add the addkcmdline attribute to the end @@ -1191,8 +1197,8 @@ sub mkinstall "/$installroot/autoinst/" . $node, $node, $pkglistfile, - undef, - undef, + $pkgdir, + $platform, $partfile ); } @@ -1482,6 +1488,16 @@ sub mksysclone my %hents = %{$hmtab->getNodesAttribs(\@nodes, ['serialport', 'serialspeed', 'serialflow'])}; + my @entries = xCAT::TableUtils->get_site_attribute("xcatdport"); + my $port_entry = $entries[0]; + my $xcatdport="3001"; + if ( defined($port_entry)) { + $xcatdport = $port_entry; + } + + my @entries = xCAT::TableUtils->get_site_attribute("master"); + my $master_entry = $entries[0]; + require xCAT::Template; # Warning message for nodeset install/netboot/statelite @@ -1507,7 +1523,7 @@ sub mksysclone } # copy postscripts - my $script1 = "efibootmgr"; + my $script1 = "configefi"; my $script2 = "updatenetwork"; my $pspath = "$installroot/sysclone/scripts/post-install/"; my $clusterfile = "$installroot/sysclone/scripts/cluster.txt"; @@ -1553,7 +1569,7 @@ sub mksysclone { $xcatmaster = $ient->{xcatmaster}; } else { - $xcatmaster = '!myipfn!'; + $xcatmaster = $master_entry; } my $osinst; @@ -1710,47 +1726,15 @@ sub mksysclone my $ramdisk_size = 200000; if ( - -r "$installroot/sysclone/images/$imagename/etc/systemimager/boot/kernel" - and $kernpath = "$installroot/sysclone/images/$imagename/etc/systemimager/boot/kernel" - and -r "$installroot/sysclone/images/$imagename/etc/systemimager/boot/initrd.img" - and $initrdpath = "$installroot/sysclone/images/$imagename/etc/systemimager/boot/initrd.img" + -r "$tftpdir/xcat/genesis.kernel.$arch" + and $kernpath = "$tftpdir/xcat/genesis.kernel.$arch" + and -r "$tftpdir/xcat/genesis.fs.$arch.lzma" + and $initrdpath = "$tftpdir/xcat/genesis.fs.$arch.lzma" ) { - #TODO: driver slipstream, targetted for network. - # Copy the install resource to /tftpboot and check to only copy once - my $docopy = 0; - my $tftppath; - my $rtftppath; # the relative tftp path without /tftpboot/ - if ($imagename) { - $tftppath = "$tftpdir/xcat/osimage/$imagename"; - $rtftppath = "xcat/osimage/$imagename"; - unless ($donetftp{$imagename}) { - $docopy = 1; - $donetftp{$imagename} = 1; - } - } else { - $tftppath = "/$tftpdir/xcat/$os/$arch/$profile"; - $rtftppath = "xcat/$os/$arch/$profile"; - unless ($donetftp{"$os|$arch|$profile|$tftpdir"}) { - $docopy = 1; - $donetftp{"$os|$arch|$profile|$tftpdir"} = 1; - } - } - - if ($docopy) { - mkpath("$tftppath"); - copy($kernpath,"$tftppath/vmlinuz"); - copy($initrdpath,"$tftppath/initrd.img"); - &insert_dd($callback, $os, $arch, "$tftppath/initrd.img", $driverupdatesrc, $netdrivers); - } - #We have a shot... my $ent = $rents{$node}->[0]; my $sent = $hents{$node}->[0]; - $instserver = $xcatmaster; - if ($ent and $ent->{nfsserver}) { - $instserver=$ent->{nfsserver}; - } my $kcmdline = "ramdisk_size=$ramdisk_size"; @@ -1821,6 +1805,7 @@ sub mksysclone $kcmdline .= "n8r"; } } + $kcmdline .= " xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename"; #$kcmdline .= " noipv6"; # add the addkcmdline attribute to the end # of the command, if it exists @@ -1832,8 +1817,8 @@ sub mksysclone #} my $k; my $i; - $k = "$rtftppath/vmlinuz"; - $i = "$rtftppath/initrd.img"; + $k = "xcat/genesis.kernel.$arch"; + $i = "xcat/genesis.fs.$arch.lzma"; $bptab->setNodeAttribs( $node, @@ -1848,7 +1833,7 @@ sub mksysclone { $callback->( { - error => ["Kernel and initrd not found in $installroot/sysclone/images/$imagename"], + error => ["Kernel and initrd not found in $tftpdir/xcat"], errorcode => [1] } ); @@ -2064,12 +2049,21 @@ sub copycd %{$request} = (); #clear request we've got it. + my $disccopiedin=0; + my $osdistroname=$distname."-".$arch; my $defaultpath="$installroot/$distname/$arch"; unless($path) { $path=$defaultpath; } + if ($::XCATSITEVALS{osimagerequired}){ + my ($nohaveimages,$errstr) = xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path,$osdistroname,checkonly=>1); + if ($nohaveimages) { + $callback->({error => "No Templates found to support $distname($arch)",errorcode=>2}); + return; + } + } #tranverse the directory structure of the os media and get the fingerprint my @filelist=(); @@ -2247,6 +2241,9 @@ sub copycd } #hiding the messages about this not being found, since it may be intentional + + my @ret=xCAT::SvrUtils->update_tables_with_mgt_image($distname, $arch, $path,$osdistroname); + my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot",$path,$osdistroname); #if ($ret[0] != 0) { #$callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]}); diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index bf24857bc..8b3b9fe70 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -1334,6 +1334,8 @@ sub mknetboot $kcmdline .= $statemnt ." "; $kcmdline .= "XCAT=$xcatmaster:$xcatdport "; + $kcmdline .= + "NODE=$node "; # BEGIN service node my $isSV = xCAT::Utils->isServiceNode(); my $res = xCAT::Utils->runcmd("hostname", 0); diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 4174bac13..a23b20259 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -553,6 +553,7 @@ sub mknetboot "imgurl=$httpmethod://$imgsrv/$rootimgdir/rootimg.$suffix "; } $kcmdline .= "XCAT=$xcatmaster:$xcatdport quiet "; + $kcmdline .= "NODE=$node "; # add the kernel-booting parameter: netdev=, or BOOTIF= my $netdev = "";