From 394792bd0c40bfafea368edb24c1d13b562f8efe Mon Sep 17 00:00:00 2001 From: mellor Date: Mon, 10 Jan 2011 20:58:16 +0000 Subject: [PATCH] rollupdate defect 3147993 - fix ll reconfig code git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8600 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/rollupdate.pm | 48 ++++++++++++++++------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/rollupdate.pm b/xCAT-server/lib/xcat/plugins/rollupdate.pm index 8733c4df8..459b94094 100644 --- a/xCAT-server/lib/xcat/plugins/rollupdate.pm +++ b/xCAT-server/lib/xcat/plugins/rollupdate.pm @@ -2485,27 +2485,51 @@ sub llreconfig { my @llms = split(/\s+/,$llcms." ".$llrms); my %have = (); my @llnodes; + my $runlocal=0; foreach my $m (@llms) { my ($sm,$rest) = split(/\./,$m); - push(@llnodes, $sm) unless $have{$sm}++; + if (xCAT::Utils->thishostisnot($m)) { + push(@llnodes, $sm) unless $have{$sm}++; + } else { + $runlocal=1; + } } - if ($::VERBOSE) { - open (RULOG, ">>$::LOGDIR/$::LOGFILE"); - print RULOG localtime()." Running command \'xdsh $llcms $llrms $cmd\'\n"; - close (RULOG); + + if ($runlocal) { + if ($::VERBOSE) { + open (RULOG, ">>$::LOGDIR/$::LOGFILE"); + print RULOG localtime()." Running local command \'$cmd\'\n"; + close (RULOG); + } + if ($::TEST) { + my $rsp; + push @{ $rsp->{data} }, "In TEST mode. Will NOT run command: $cmd "; + xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); + $::RUNCMD_RC = 0; + } else { + xCAT::Utils->runcmd( $cmd, 0 ); + } } - if ($::TEST) { - my $rsp; - push @{ $rsp->{data} }, "In TEST mode. Will NOT run command: xdsh $cmd "; - xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); - $::RUNCMD_RC = 0; - } else { - xCAT::Utils->runxcmd( + + if ( scalar(@llnodes) > 0 ) { + if ($::VERBOSE) { + open (RULOG, ">>$::LOGDIR/$::LOGFILE"); + print RULOG localtime()." Running command \'xdsh $llcms $llrms $cmd\'\n"; + close (RULOG); + } + if ($::TEST) { + my $rsp; + push @{ $rsp->{data} }, "In TEST mode. Will NOT run command: xdsh $cmd "; + xCAT::MsgUtils->message( "I", $rsp, $::CALLBACK ); + $::RUNCMD_RC = 0; + } else { + xCAT::Utils->runxcmd( { command => ['xdsh'], node => \@llnodes, arg => [ "-v", $cmd ] }, $::SUBREQ, -1); + } } }