From 02e9cb3760890f7486f9e5b3059d9f8572c85b8d Mon Sep 17 00:00:00 2001 From: ligc Date: Tue, 11 Oct 2011 08:37:07 +0000 Subject: [PATCH] fix for bug 3421484: redirect ps to handle basecust perminent git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10738 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/redirectps | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/xCAT/postscripts/redirectps b/xCAT/postscripts/redirectps index fdd0ba096..1b1f39fb6 100755 --- a/xCAT/postscripts/redirectps +++ b/xCAT/postscripts/redirectps @@ -15,10 +15,13 @@ if (!$ENV{'NFSSERVER'}) } my $nfsserver = $ENV{'NFSSERVER'}; +my @ps = (); +my @nfsserverps = (); my $cmd = "lsps -t nfs -c"; &runcmd($cmd); +# Remove any inactive paging space from external nfs server first foreach my $line (@::outref) { chomp($line); @@ -28,19 +31,44 @@ foreach my $line (@::outref) } my ($psname, $pshost, $psfile, $pssize, $psused, $psactive, $psauto, $pstype, $pschksum) = split(/:/, $line); if ($pshost eq $nfsserver) + { + if ($psactive eq 'n') + { + # Inactive paging space, remove it + $cmd = "rmps $psname"; + &runcmd($cmd); + } + else + { + push @nfsserverps, $psfile + } + } + else + { + push @ps, $line; + } +} + +foreach my $psline (@ps) +{ + my ($psname, $pshost, $psfile, $pssize, $psused, $psactive, $psauto, $pstype, $pschksum) = split(/:/, $psline); + if ($pshost eq $nfsserver) { next; } - my $cmd = "mkps -a -n -t nfs $nfsserver $psfile"; - &runcmd($cmd); + if (!grep(/^$psfile$/, @nfsserverps)) + { + my $cmd = "mkps -a -n -t nfs $nfsserver $psfile"; + &runcmd($cmd); + } $cmd = "swapoff /dev/$psname"; &runcmd($cmd); $cmd = "rmps $psname"; &runcmd($cmd); - } + sub runcmd { my ($cmd) = @_;