From 9be66d4e283e0922fe250f2fcebd2f0d92d16487 Mon Sep 17 00:00:00 2001 From: huweihua Date: Thu, 19 Jun 2014 04:48:08 -0400 Subject: [PATCH] sysclone add feature: update delta change from golden client to target node --- xCAT-server/lib/xcat/plugins/sles.pm | 40 ++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 5797dd21b..483cafc90 100755 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1352,6 +1352,7 @@ sub mksysclone copy("$installroot/postscripts/configefi","$pspath/15all.configefi"); copy("$installroot/postscripts/updatenetwork","$pspath/16all.updatenetwork"); copy("$installroot/postscripts/runxcatpost","$pspath/17all.runxcatpost"); + copy("$installroot/postscripts/makeinitrd","$pspath/20all.makeinitrd"); copy("$installroot/postscripts/killsyslog","$pspath/99all.killsyslog"); unless (-r "$pspath/10all.fix_swap_uuids") @@ -1509,14 +1510,43 @@ sub mksysclone my $out = `sed -i /$node./d $clusterfile`; } } - + my $cmd =qq{echo "$node:compute:$imagename:" >> $clusterfile}; - my $out = xCAT::Utils->runcmd($cmd, -1); + my $rc = xCAT::Utils->runcmd($cmd, -1); - unless (-r "$installroot/sysclone/images/$imagename/opt/xcat/xcatdsklspost") + my $imagedir; + my $osimagetab = xCAT::Table->new('linuximage'); + my $osimageentry = $osimagetab->getAttribs({imagename => $imagename}, 'rootimgdir'); + if($osimageentry){ + $imagedir = $osimageentry->{rootimgdir}; + $imagedir =~ s/^(\/.*)\/.+\/?$/$1/; + }else{ + $imagedir = "$installroot/sysclone/images"; + $cmd = "chdef -t osimage $imagename rootimgdir=$imagedir/$imagename"; + $rc = `$cmd`; + } + + my $cfgimagedir = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`; + chomp($cfgimagedir); + $cfgimagedir =~ s/^\s+path=(\/.*)\/.+$/$1/g; + + if($imagedir ne $cfgimagedir){ + my $oldstr = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`; + chomp($oldstr); + $oldstr =~ s/\//\\\\\//g; + + my $targetstr="\tpath=".$imagedir."/".$imagename; + $targetstr =~ s/\//\\\\\//g; + $cmd= "sed -i \"s/$oldstr/$targetstr/\" /etc/systemimager/rsync_stubs/40$imagename"; + $rc = `$cmd`; + } + + $rc = `export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_mkrsyncd_conf`; + + unless (-r "$imagedir/$imagename/opt/xcat/xcatdsklspost") { - mkpath("$installroot/sysclone/images/$imagename/opt/xcat/"); - copy("$installroot/postscripts/xcatdsklspost","$installroot/sysclone/images/$imagename/opt/xcat/"); + mkpath("$imagedir/$imagename/opt/xcat/"); + copy("$installroot/postscripts/xcatdsklspost","$imagedir/$imagename/opt/xcat/"); } }