From 9f8a0031075ea415663ac50b80a773b3dab14434 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Thu, 26 Sep 2013 03:04:36 -0400 Subject: [PATCH] check in the code to support the driver injection for stateless: 1. genimage will copy the generated initrd to /tftpboot;2. support nodeset --noupdateinitrd --- xCAT-server/lib/xcat/plugins/anaconda.pm | 3 ++- xCAT-server/lib/xcat/plugins/genimage.pm | 27 ++++++++++++++++++++++++ xCAT-server/lib/xcat/plugins/sles.pm | 3 ++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 97096710d..446634564 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -172,6 +172,7 @@ sub mknetboot my $nodes = @{$req->{node}}; my @args = @{$req->{arg}} if(exists($req->{arg})); my @nodes = @{$req->{node}}; + my $noupdateinitrd = $req->{'noupdateinitrd'}; my $ostab = xCAT::Table->new('nodetype'); #my $sitetab = xCAT::Table->new('site'); my $linuximagetab; @@ -522,7 +523,7 @@ sub mknetboot } } - if ($docopy) { + if ($docopy && !$noupdateinitrd) { mkpath("$tftppath"); if (-f "$rootimgdir/hypervisor") { copy("$rootimgdir/hypervisor", "$tftppath"); diff --git a/xCAT-server/lib/xcat/plugins/genimage.pm b/xCAT-server/lib/xcat/plugins/genimage.pm index 6284a16eb..9108dec90 100644 --- a/xCAT-server/lib/xcat/plugins/genimage.pm +++ b/xCAT-server/lib/xcat/plugins/genimage.pm @@ -10,6 +10,7 @@ use xCAT::SvrUtils; use xCAT::Table; #use Data::Dumper; use File::Path; +use File::Copy; use Getopt::Long; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -169,6 +170,7 @@ sub process_request { $otherpkglist = $ref_linuximage_tab->{'otherpkglist'}; $postinstall_filename = $ref_linuximage_tab->{'postinstall'}; $destdir = $ref_linuximage_tab->{'rootimgdir'}; + $rootimg_dir = $ref_linuximage_tab->{'rootimgdir'}; $driverupdatesrc = $ref_linuximage_tab->{'driverupdatesrc'}; # TODO: how can we do if the user specifies one wrong value to the following attributes? @@ -363,6 +365,31 @@ sub process_request { # print FILE "\n"; #} #close FILE; + + # update the generated initrd to /tftpboot/xcat so that don't need to rerun nodeset to update them + if (($::RUNCMD_RC == 0) && $imagename) { + my $tftpdir = "/tftpboot"; + my @siteents = xCAT::TableUtils->get_site_attribute("tftpdir"); + if ($#siteents >= 0) + { + $tftpdir = $siteents[0]; + } + my $tftppath = "$tftpdir/xcat/osimage/$imagename"; + + my $installdir = "/install"; + @siteents = xCAT::TableUtils->get_site_attribute("installdir"); + if ($#siteents >= 0) + { + $installdir = $siteents[0]; + } + + unless (-d $tftppath) { + mkpath $tftppath; + } + copy("$rootimg_dir/initrd-stateless.gz", "$tftppath"); + copy("$rootimg_dir/initrd-statelite.gz", "$tftppath"); + copy("$rootimg_dir/kernel", "$tftppath"); + } #parse the output and save the image data to osimage and linuximage table save_image_data($callback, $doreq, $tempfile); diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index f9a660289..d887ce0a1 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -56,6 +56,7 @@ sub mknetboot my $globaltftpdir = "/tftpboot"; my $nodes = @{$req->{node}}; my @nodes = @{$req->{node}}; + my $noupdateinitrd = $req->{'noupdateinitrd'}; my $ostab = xCAT::Table->new('nodetype'); #my $sitetab = xCAT::Table->new('site'); my $linuximagetab; @@ -405,7 +406,7 @@ sub mknetboot } } - if ($docopy) { + if ($docopy && !$noupdateinitrd) { mkpath("$tftppath"); copy("$rootimgdir/kernel", "$tftppath"); if ($statelite) {