From 7260f1697a543cd788aa573c809ff8f2dd06361f Mon Sep 17 00:00:00 2001 From: linggao Date: Wed, 22 Jun 2011 20:38:25 +0000 Subject: [PATCH] fix defect 3323266 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9903 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/packimage.pm | 39 ++++++++++++++++------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 7b8e94791..0cff3afeb 100644 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -121,6 +121,22 @@ sub process_request { $exlistloc =$ref1->{'exlist'}; $destdir=$ref1->{'rootimgdir'}; + } else { + $provmethod="netboot"; + unless ($osver) { + $callback->({error=>["Please specify a os version with the -o flag"],errorcode=>[1]}); + return; + } + unless ($arch) { + $arch = `uname -m`; + chomp($arch); + $arch = "x86" if ($arch =~ /i.86$/); + } + + unless ($profile) { + $callback->({error=>["Please specify a profile name with -p flag"],errorcode=>[1]}); + return; + } } unless ($destdir) { @@ -136,28 +152,29 @@ sub process_request { $callback->({error=>["Unable to find $::XCATROOT/share/xcat/netboot directory for $osver"],errorcode=>[1]}); return; } - unless ($installroot) { - $callback->({error=>["No installdir defined in site table"],errorcode=>[1]}); - return; - } - my $oldpath=cwd(); + unless ($installroot) { + $callback->({error=>["No installdir defined in site table"],errorcode=>[1]}); + return; + } + my $oldpath=cwd(); unless ($imagename) { $exlistloc=xCAT::SvrUtils->get_exlist_file_name("$installroot/custom/netboot/$distname", $profile, $osver, $arch); unless ($exlistloc) { $exlistloc=xCAT::SvrUtils->get_exlist_file_name("$::XCATROOT/share/xcat/netboot/$distname", $profile, $osver, $arch); } + + #save the settings into DB, it will not update if the image already exist + my @ret = xCAT::SvrUtils->update_tables_with_diskless_image($osver, $arch, $profile, "netboot"); + unless ($ret[0] eq 0) { + $callback->({error=>["Error when updating the osimage tables: " . $ret[1]], errorcode=>[1]}); + return; + } } - # before generating rootimg.gz or rootimg.sfs, need to switch the rootimg to stateless mode if necessary my $rootimg_status = 0; # 0 means stateless mode, while 1 means statelite mode $rootimg_status = 1 if (-f "$rootimg_dir/.statelite/litefile.save"); my $ref_liteList; # get the litefile entries - my @ret = xCAT::SvrUtils->update_tables_with_diskless_image($osver, $arch, $profile, "statelite"); - unless ($ret[0] eq 0) { - $callback->({error=>["Error when updating the osimage tables: " . $ret[1]], errorcode=>[1]}); - return; - } my @ret = xCAT::Utils->runcmd("ilitefile $osver-$arch-statelite-$profile" , 0, 1); $ref_liteList = $ret[0];