From afff5fa64bb36527efeadd2b65200a0259b75a01 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Thu, 19 Jan 2012 08:01:57 +0000 Subject: [PATCH] Adding synclist support for statelite and also adding synclists support for user customized imagenames git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11395 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/SvrUtils.pm | 13 ++++++++++++- xCAT-server/lib/xcat/plugins/packimage.pm | 14 ++++++-------- xCAT-server/lib/xcat/plugins/statelite.pm | 19 +++++++++---------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/SvrUtils.pm b/xCAT-server/lib/perl/xCAT/SvrUtils.pm index 346a466b5..58fad5fe3 100644 --- a/xCAT-server/lib/perl/xCAT/SvrUtils.pm +++ b/xCAT-server/lib/perl/xCAT/SvrUtils.pm @@ -241,7 +241,7 @@ sub getsynclistfile() $nodes = shift; } - my ($os, $arch, $profile, $inst_type) = @_; + my ($os, $arch, $profile, $inst_type, $imgname) = @_; my $installdir = xCAT::Utils->getInstallDir(); @@ -364,6 +364,17 @@ sub getsynclistfile() return \%node_syncfile; } else { + if ($imgname) { + my $osimage_t = xCAT::Table->new('osimage'); + unless ($osimage_t) { + return ; + } + my $synclist = $osimage_t->getAttribs({imagename=>$imgname}, 'synclists'); + if ($synclist && $synclist->{'synclists'}) { + return $synclist->{'synclists'}; + } + } + my $platform = ""; if ($os) { if ($os =~ /rh.*/) { $platform = "rh"; } diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 10e5164bd..c201d6e02 100644 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -316,14 +316,12 @@ sub process_request { umask($oldmask); } - # sync fils configured in the synclist to the rootimage - unless ($imagename) { - $syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot"); - if (defined ($syncfile) && -f $syncfile - && -d $rootimg_dir) { - print "sync files from $syncfile to the $rootimg_dir\n"; - system("$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile"); - } + # sync fils configured in the synclist to the rootimage + $syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot", $imagename); + if (defined ($syncfile) && -f $syncfile + && -d $rootimg_dir) { + print "sync files from $syncfile to the $rootimg_dir\n"; + system("$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile"); } my $verb = "Packing"; diff --git a/xCAT-server/lib/xcat/plugins/statelite.pm b/xCAT-server/lib/xcat/plugins/statelite.pm index eb87aa265..d90482715 100644 --- a/xCAT-server/lib/xcat/plugins/statelite.pm +++ b/xCAT-server/lib/xcat/plugins/statelite.pm @@ -187,16 +187,6 @@ sub process_request { umask($oldmask); } - # sync fils configured in the synclist to the rootimage - #if (!$imagename) { - # $syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot"); - # if (defined ($syncfile) && -f $syncfile - # && -d $rootimg_dir) { - # print "sync files from $syncfile to the $rootimg_dir\n"; - # `$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile`; - # } - #} - my $distname = $osver; unless ( -r "$::XCATROOT/share/xcat/netboot/$distname/" or not $distname) { chop($distname); @@ -220,6 +210,15 @@ sub process_request { $exlistloc = xCAT::SvrUtils->get_exlist_file_name("$::XCATROOT/share/xcat/netboot/$distname", $profile, $osver, $arch); } } + + #sync fils configured in the synclist to the rootimage + $syncfile = xCAT::SvrUtils->getsynclistfile(undef, $osver, $arch, $profile, "netboot", $imagename); + if (defined ($syncfile) && -f $syncfile + && -d $rootimg_dir) { + print "sync files from $syncfile to the $rootimg_dir\n"; + `$::XCATROOT/bin/xdcp -i $rootimg_dir -F $syncfile`; + } + # check if the file "litefile.save" exists or not # if it doesn't exist, then we get the synclist, and run liteMe # if it exists, it means "liteimg" has run more than one time, we need to compare with the synclist