fix for --setuphanfs work with mkdsklsnode -b

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12369 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
ligc 2012-04-27 10:05:49 +00:00
parent bc8a686c01
commit 795a6ed852

View File

@ -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 '*'";