From b9895eec4d283349236439a85024d7dbff527039 Mon Sep 17 00:00:00 2001 From: nott Date: Tue, 28 Jul 2009 15:25:37 +0000 Subject: [PATCH] Remove spot and lpp_source backup files when done. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3887 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/aixinstall.pm | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index bf0f9c0bd..cbc8d64f9 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -2335,7 +2335,7 @@ sub rmnimimage # Get a list of the all the locally defined nim resources # my $cmd = qq~/usr/sbin/lsnim -c resources | /usr/bin/cut -f1 -d' ' 2>/dev/null~; - my @nimresources = []; + my @nimresources = (); @nimresources = xCAT::Utils->runcmd("$cmd", -1); if ($::RUNCMD_RC != 0) { @@ -3448,7 +3448,7 @@ sub nimnodecust # get list of NIM machines defined locally - my @machines = []; + my @machines = (); my $cmd = qq~/usr/sbin/lsnim -c machines | /usr/bin/cut -f1 -d' ' 2>/dev/null~; @machines = xCAT::Utils->runcmd("$cmd", -1); @@ -4222,6 +4222,7 @@ sub copyres return 1; } push @::resbacked, $resname; + push @::removebk, $bkfile; } # copy the file to the SN @@ -4243,6 +4244,7 @@ sub copyres return 1; } push @::resbacked, $resname; + push @::removebk, $bkfile; } # copy the file to the SN @@ -4340,9 +4342,12 @@ sub doSNcopy # - copy whatever is needed to the SNs # - # keep track if spot/lpp_source has already been backed up + # keep track if spot or lpp_source has already been backed up @::resbacked=(); + # list of backup files to remove from the MN when done + @::removebk=(); + foreach my $snkey (keys %$sn) { my @nimresources; if (!&is_me($snkey) ) { @@ -4436,6 +4441,20 @@ sub doSNcopy } # end - if the SN is not me } # end - for each SN + # remove any lpp_source or spot backup files that were created + foreach my $file (@::removebk) { + my $rmcmd = "/usr/bin/rm -f $file"; + my $output = xCAT::Utils->runcmd("$rmcmd", -1); + if ($::RUNCMD_RC != 0) { + my $rsp; + push @{$rsp->{data}}, "Could not remove backup file: $file\n"; + if ($::VERBOSE) { + push @{$rsp->{data}}, "$output"; + } + xCAT::MsgUtils->message("E", $rsp, $callback); + } + } + return 0; } @@ -4639,7 +4658,7 @@ sub mkdsklsnode # Get a list of the defined NIM machines # these are machines defined on this server # - my @machines = []; + my @machines = (); my $cmd = qq~/usr/sbin/lsnim -c machines | /usr/bin/cut -f1 -d' ' 2>/dev/nu ll~;