Remove mounts only start NFS.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1358 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
14dcde4a3f
commit
8dc8987890
@ -13,8 +13,7 @@ use Getopt::Long;
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head1
|
||||
xCAT plugin package to setup of nfs and mount /install
|
||||
and /tfptboot
|
||||
xCAT plugin package to start nfs
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
@ -23,7 +22,6 @@ use Getopt::Long;
|
||||
|
||||
Check to see if on a Service Node
|
||||
Check database to see if this node is a NFS server
|
||||
should be always
|
||||
Call setup_NFS
|
||||
|
||||
=cut
|
||||
@ -34,12 +32,7 @@ sub handled_commands
|
||||
|
||||
{
|
||||
my $rc = 0;
|
||||
mkpath "/var/ftp/install";
|
||||
mkpath "/var/ftp/tftpboot";
|
||||
system "mount -o bind $installdir /var/ftp/install";
|
||||
system "mount -o bind /tftpboot /var/ftp/tftpboot";
|
||||
# make sure vsftpd is started
|
||||
my $cmd = "service vsftpd start";
|
||||
|
||||
if (xCAT::Utils->isServiceNode())
|
||||
{
|
||||
my @nodeinfo = xCAT::Utils->determinehostname;
|
||||
@ -47,7 +40,7 @@ sub handled_commands
|
||||
my @nodeipaddr = @nodeinfo; # get ip addresses
|
||||
my $service = "nfsserver";
|
||||
$rc = xCAT::Utils->isServiceReq($nodename, $service, \@nodeipaddr);
|
||||
if ($rc == 1)
|
||||
if ($rc == 1)
|
||||
{
|
||||
|
||||
# service needed on this Service Node
|
||||
@ -59,11 +52,10 @@ sub handled_commands
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($rc == 2) # this is probably no longer needed on Service Node
|
||||
if ($rc == 2)
|
||||
{ # just start the daemon
|
||||
my $cmd = "service nfs start";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
system "service nfs restart";
|
||||
if ($? > 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S", "Error on command: $cmd");
|
||||
return 1;
|
||||
@ -92,8 +84,7 @@ sub process_request
|
||||
|
||||
=head3 setup_NFS
|
||||
|
||||
Sets up NFS services and mounts /install
|
||||
on /install from Master Node
|
||||
Sets up NFS services
|
||||
|
||||
=cut
|
||||
|
||||
@ -101,113 +92,23 @@ sub process_request
|
||||
sub setup_NFS
|
||||
{
|
||||
my ($nodename) = @_;
|
||||
my $rc = 0;
|
||||
my $installdir = "/install"; # default
|
||||
my $rc = 0;
|
||||
|
||||
# read DB for nodeinfo
|
||||
my $master;
|
||||
my $os;
|
||||
my $arch;
|
||||
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
system "chkconfig nfs on";
|
||||
if ($? > 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S", "Error on command: $cmd");
|
||||
xCAT::MsgUtils->message("S", "Error on command:$cmd");
|
||||
}
|
||||
my $cmd = "chkconfig vsftpd on";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S", "Error on command:$cmd");
|
||||
}
|
||||
my $retdata = xCAT::Utils->readSNInfo($nodename);
|
||||
if ($retdata->{'arch'})
|
||||
{ # no error
|
||||
$master = $retdata->{'master'};
|
||||
$os = $retdata->{'os'};
|
||||
$arch = $retdata->{'arch'};
|
||||
|
||||
# read install directory from database, if it exists
|
||||
my @installdir1 = xCAT::Utils->get_site_attribute("installdir");
|
||||
if ($installdir1[0])
|
||||
{
|
||||
$installdir = $installdir1[0];
|
||||
}
|
||||
if (!(-e $installdir))
|
||||
{
|
||||
mkdir($installdir);
|
||||
}
|
||||
# the start of nfs is not really needed for the mount
|
||||
# remove in the future
|
||||
my $cmd = "chkconfig nfs on";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S", "Error on command:$cmd");
|
||||
}
|
||||
|
||||
# make sure nfs is restarted
|
||||
my $cmd = "service nfs stop";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S", "Error on command: $cmd");
|
||||
return 1;
|
||||
}
|
||||
|
||||
# make sure nfs is started
|
||||
my $cmd = "service nfs start";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
xCAT::MsgUtils->message("S", "Error on command: $cmd");
|
||||
return 1;
|
||||
}
|
||||
|
||||
# check to see if install already mounted
|
||||
my $directory = $installdir;
|
||||
$cmd = "df -P $directory";
|
||||
my @output = xCAT::Utils->runcmd($cmd, -1);
|
||||
my $found = 0;
|
||||
foreach my $line (@output)
|
||||
{
|
||||
my ($file_sys, $blocks, $used, $avail, $cap, $mount_point) =
|
||||
split(' ', $line);
|
||||
if ($mount_point eq $directory)
|
||||
{
|
||||
$found = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($found == 0)
|
||||
{
|
||||
|
||||
# need to mount the directory
|
||||
my $cmd = " mount -o rw,nolock $master:$directory $directory";
|
||||
xCAT::Utils->runcmd($cmd, 0);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{ # error
|
||||
$rc=1;
|
||||
xCAT::MsgUtils->message("S", "Error $cmd");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{ # error reading Db
|
||||
$rc = 1;
|
||||
}
|
||||
if ($rc == 0)
|
||||
# make sure nfs is restarted
|
||||
system "service nfs restart";
|
||||
if ($? > 0)
|
||||
{
|
||||
|
||||
# update fstab to mount on reboot
|
||||
$cmd = "grep $master:$installdir $installdir /etc/fstab ";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0)
|
||||
{
|
||||
`echo "$master:$installdir $installdir nfs timeo=14,intr 1 2" >>/etc/fstab`;
|
||||
}
|
||||
xCAT::MsgUtils->message("S", "Error on command: $cmd");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return $rc;
|
||||
}
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user