if the nfs directory is set on the service node, but is not added into /etc/exports,

then will be added into /etc/exports when running "nodeset <nr> install";


git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5695 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
mxi1 2010-04-07 06:16:51 +00:00
parent 53d4ac84be
commit 2ddad2d1df
2 changed files with 44 additions and 0 deletions

View File

@ -1260,6 +1260,16 @@ sub setupNFSTree {
xCAT::Utils->runcmd($cmd, 0);
# exportfs can export this directory immediately
$callback->({data=>["now $nfsdirectory is exported!"]});
$cmd = "cat /etc/exports";
@entries = xCAT::Utils->runcmd($cmd, 0);
if(my $entry = grep /\Q$nfsdirectory\E/, @entries) {
# nothing to do
}else {
# if no entry in /etc/exports, one entry with default options will be added
$cmd = qq{echo "$nfsdirectory *(rw,no_root_squash,sync,no_subtree_check)" >> /etc/exports};
xCAT::Utils->runcmd($cmd, 0);
$callback->({data=>["$nfsdirectory is added to /etc/exports with default option"]});
}
}
}
}
@ -1293,6 +1303,19 @@ sub setupStatemnt {
$cmd = "/usr/sbin/exportfs :$nfsdirectory -o rw,no_root_squash,sync,no_subtree_check";
xCAT::Utils->runcmd($cmd, 0);
$callback->({data=>["now $nfsdirectory is exported!"]});
# add the directory into /etc/exports if not exist
$cmd = "cat /etc/exports";
@entries = xCAT::Utils->runcmd($cmd, 0);
if(my $entry = grep /\Q$nfsdirectory\E/, @entries) {
if ($entry =~ m/rw/) {
# nothing to do
} else {
$callback->({data => ["The $nfsdirectory should be with rw option in /etc/exports"]});
}
} else {
xCAT::Utils->runcmd(qq{echo "$nfsdirectory *(rw,no_root_squash,sync,no_subtree_check)" >> /etc/exports}, 0);
$callback->({data => ["$nfsdirectory is added into /etc/exports with default options"]});
}
}
}
}

View File

@ -1184,6 +1184,16 @@ sub setupNFSTree {
xCAT::Utils->runcmd($cmd, 0);
# exportfs can export this directory immediately
$callback->({data=>["now $nfsdirectory is exported!"]});
$cmd = "cat /etc/exports";
@entries = xCAT::Utils->runcmd($cmd, 0);
if(my $entry = grep /\Q$nfsdirectory\E/, @entries) {
# nothing to do
} else {
#if there's no entry in /etc/exports, one with default option is added
$cmd = qq{echo "$nfsdirectory *(rw,no_root_squash,sync,no_subtree_check)" >> /etc/exports};
xCAT::Utils->runcmd($cmd, 0);
$callback->({data=>["$nfsdirectory is added into /etc/exports with default option"]});
}
}
}
}
@ -1216,6 +1226,17 @@ sub setupStatemnt {
$cmd = "/usr/sbin/exportfs :$nfsdirectory -o rw,no_root_squash,sync,no_subtree_check";
xCAT::Utils->runcmd($cmd, 0);
$callback->({data=>["now $nfsdirectory is exported!"]});
# add the directory into /etc/exports if not exist
$cmd = "cat /etc/exports";
@entries = xCAT::Utils->runcmd($cmd, 0);
if(my $entry = grep /\Q$nfsdirectory\E/, @entries) {
if ($entry =~ m/rw/) {
}esle {
$callback->({data=>["The $nfsdirectory should be with rw option in /etc/exports"]});
}
}else {
xCAT::Utils->runcmd(qq{echo "$nfsdirectory *(rw,no_root_squash,sync,no_subtree_check)" >>/etc/exports}, 0);
}
}
}