diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 0d4eaeb14..fc9a27f87 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -934,6 +934,8 @@ site => { " mgmt node.\n\n". " timezone: (e.g. America/New_York)\n\n". " tftpdir: tftp directory path. Default is /tftpboot\n\n". + " tftpflags: The flags that used to start tftpd. Default is \'-v -l -s /tftpboot \n". + " -m /etc/tftpmapfile4xcat.conf\' if tftplfags is not set\n\n". " useNmapfromMN: When set to yes, nodestat command should obtain the node status\n". " using nmap (if available) from the management node instead of the\n". " service node. This will improve the performance in a flat network.\n\n". diff --git a/xCAT-server/lib/xcat/plugins/AAsn.pm b/xCAT-server/lib/xcat/plugins/AAsn.pm index 1461cdab1..d05711624 100644 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -1415,7 +1415,7 @@ sub enable_TFTPhpa push @newcfgfile, $_; } } elsif (/^\s*disable\s*=/ && !/^\s*disable\s*=\s*yes/) { - # enable the tftp by handling the entry 'disable = xx' + # disable the tftp by handling the entry 'disable = yes' my $newcfg = $_; $newcfg =~ s/=.*$/= yes/; push @newcfgfile, $newcfg; @@ -1464,23 +1464,9 @@ sub enable_TFTPhpa } } } -# /usr/sbin/in.tftpd -V -# tftp-hpa 0.49, with remap, with tcpwrappers -# - - - - - - # start xinetd - #my $rc = xCAT::Utils->startService("xinetd"); - #if ($rc != 0) - #{ - # xCAT::MsgUtils->message("S", " Failed to start xinetd."); - # return 1; - #} - #xCAT::MsgUtils->message("S", " The tftp-hpa has been reconfigured."); } + + # get the version of TCP/IP protocol my $protocols; my $v4only="-4 "; open($protocols,"<","/proc/net/protocols"); @@ -1495,13 +1481,21 @@ sub enable_TFTPhpa } else { $v4only=""; } + + # get the tftpflags which set by customer + my $tftpflags = xCAT::Utils->get_site_attribute("tftpflags"); + my $startcmd = "/usr/sbin/in.tftpd $v4only -v -l -s $tftpdir -m /etc/tftpmapfile4xcat.conf"; + if ($tftpflags) { + $startcmd = "/usr/sbin/in.tftpd $v4only $tftpflags"; + } + if (-x "/usr/sbin/in.tftpd") { system("killall in.tftpd"); #xinetd can leave behind blocking tftp servers even if it won't start new ones my @tftpprocs=`ps axf|grep -v grep|grep in.tftpd`; while (@tftpprocs) { sleep 0.1; } - system("/usr/sbin/in.tftpd $v4only -v -l -s /tftpboot -m /etc/tftpmapfile4xcat.conf"); + system("$startcmd"); } return 0;