From 3215c065e6fcb518573fada6bfaf50e732d39b25 Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 13 May 2008 18:25:39 +0000 Subject: [PATCH] mount /tftpboot before starting daemon git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1375 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm | 62 ++++++++++------------ 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm b/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm index 028971e38..0be8fd83c 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/TFTPsn.pm @@ -12,7 +12,7 @@ use Getopt::Long; #------------------------------------------------------- =head1 - xCAT plugin package to setup atftp service node + xCAT plugin package to setup atftp on a service node #------------------------------------------------------- @@ -41,8 +41,8 @@ sub handled_commands $rc = xCAT::Utils->isServiceReq($nodename, $service, \@nodeipaddr); if ($rc == 1) { - - $rc = &setup_TFTP($nodename); # setup TFTP (ATFTP) + + $rc = &setup_TFTP($nodename); # setup TFTP (ATFTP) if ($rc == 0) { xCAT::Utils->update_xCATSN($service); @@ -105,12 +105,12 @@ sub setup_TFTP } # read DB for nodeinfo - my $retdata = xCAT::Utils->readSNInfo($nodename); + my $retdata = xCAT::Utils->readSNInfo($nodename); $master = $retdata->{'master'}; $os = $retdata->{'os'}; $arch = $retdata->{'arch'}; if (!($arch)) - { # error + { # error xCAT::MsgUtils->message("S", " Error reading service node arch."); return 1; } @@ -119,20 +119,38 @@ sub setup_TFTP $cmd = "/usr/sbin/in.tftpd -V"; my @output = xCAT::Utils->runcmd($cmd, -1); if ($::RUNCMD_RC != 0) - { # not installed + { # not installed xCAT::MsgUtils->message("S", "atftp is not installed"); return 1; } - if ($output[0] =~ "atftp") # it is atftp + if ($output[0] =~ "atftp") # it is atftp { - # read tftp directory from database, if it exists + # read tftpdir directory from database my @tftpdir1 = xCAT::Utils->get_site_attribute("tftpdir"); if ($tftpdir1[0]) { $tftpdir = $tftpdir1[0]; } - mkdir($tftpdir); + if (!(-e $tftpdir)) + { + mkdir($tftpdir); + } + + # check to see if tftp directory already mounted + my $mounted = xCAT::Utils->isMounted($tftpdir); + if ($mounted == 0) # not already mounted + { + + # need to mount the directory + my $cmd = " mount -o rw,nolock $master:$tftpdir $tftpdir"; + system $cmd; + if ($? > 0) + { # error + $rc = 1; + xCAT::MsgUtils->message("S", "Error $cmd"); + } + } # start atftp @@ -156,32 +174,6 @@ sub setup_TFTP return 1; } - # read tftpdir directory from database, if it exists - my @tftpdir1 = xCAT::Utils->get_site_attribute("tftpdir"); - if ($tftpdir1[0]) - { - $tftpdir = $tftpdir1[0]; - } - if (!(-e $tftpdir)) - { - mkdir($tftpdir); - } - - # check to see if tftp directory already mounted - # if not mount then - my $mounted = xCAT::Utils->isMounted($tftpdir); - if ($mounted == 0) # not already mounted - { - - # need to mount the directory - my $cmd = " mount -o rw,nolock $master:$tftpdir $tftpdir"; - system $cmd; - if ($? > 0) - { # error - $rc = 1; - xCAT::MsgUtils->message("S", "Error $cmd"); - } - } if ($rc == 0) {