From 5cf83aad5b58f97d8689287b9849f145759ee65e Mon Sep 17 00:00:00 2001 From: ligc Date: Fri, 27 Apr 2012 10:06:10 +0000 Subject: [PATCH] fix for --setuphanfs work with mkdsklsnode -b git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@12370 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/aixinstall.pm | 72 ++++++++++++---------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/aixinstall.pm b/xCAT-server/lib/xcat/plugins/aixinstall.pm index 457a34c72..f97084044 100644 --- a/xCAT-server/lib/xcat/plugins/aixinstall.pm +++ b/xCAT-server/lib/xcat/plugins/aixinstall.pm @@ -10553,7 +10553,46 @@ sub mkdsklsnode $error++; } + my $needexport = 1; + my $install_dir; + # Remove the exports added by NIM if ($::SETUPHANFS) + { + $install_dir = xCAT::Utils->getInstallDir(); + $scmd = "lsnfsexp -c"; + my @output = xCAT::Utils->runcmd("$scmd", -1); + if ($::RUNCMD_RC != 0) + { + my $rsp; + push @{$rsp->{data}}, "Could not list nfs exports on $Sname.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + $error++; + } + foreach my $line (@output) + { + next if ($line =~ /^#/); + my ($directory,$anonuid,$public,$versions,$exname,$refer,$replica,$allother) = split(':', $line); + if (($directory eq $install_dir) && ($replica)) + { + $needexport = 0; + last; + } + if ($directory =~ /^$install_dir/) + { + my $scmd = "rmnfsexp -d $directory"; + my $output = xCAT::Utils->runcmd("$scmd", -1); + if ($::RUNCMD_RC != 0) + { + my $rsp; + push @{$rsp->{data}}, "Could not unexport NFS directory $directory on $Sname.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + $error++; + } + } + } + } + + if ($::SETUPHANFS && !$::BACKUP) { # Determine the service nodes pair my %snhash = (); @@ -10719,39 +10758,6 @@ sub mkdsklsnode xCAT::MsgUtils->message("E", $rsp, $callback); $error++; } - my $install_dir = xCAT::Utils->getInstallDir(); - $scmd = "lsnfsexp -c"; - my @output = xCAT::Utils->runcmd("$scmd", -1); - if ($::RUNCMD_RC != 0) - { - my $rsp; - push @{$rsp->{data}}, "Could not list nfs exports on $Sname.\n"; - xCAT::MsgUtils->message("E", $rsp, $callback); - $error++; - } - my $needexport = 1; - foreach my $line (@output) - { - next if ($line =~ /^#/); - my ($directory,$anonuid,$public,$versions,$exname,$refer,$replica,$allother) = split(':', $line); - if (($directory eq $install_dir) && ($replica)) - { - $needexport = 0; - last; - } - if ($directory =~ /^$install_dir/) - { - my $scmd = "rmnfsexp -d $directory"; - my $output = xCAT::Utils->runcmd("$scmd", -1); - if ($::RUNCMD_RC != 0) - { - my $rsp; - push @{$rsp->{data}}, "Could not unexport NFS directory $directory on $Sname.\n"; - xCAT::MsgUtils->message("E", $rsp, $callback); - $error++; - } - } - } if ($needexport) { my $scmd = "mknfsexp -d $install_dir -B -v 4 -g $install_dir\@$xcatmasterip:$install_dir\@$remoteip -x -t rw -r '*'";