diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index ec639ed7d..9816e4e4e 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -943,6 +943,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/perl-xCAT/xCAT/Schema.pm.PCM b/perl-xCAT/xCAT/Schema.pm.PCM index c289f16a3..a3a8f3af4 100644 --- a/perl-xCAT/xCAT/Schema.pm.PCM +++ b/perl-xCAT/xCAT/Schema.pm.PCM @@ -969,6 +969,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 fe10c7b6d..b89bd1646 100644 --- a/xCAT-server/lib/xcat/plugins/AAsn.pm +++ b/xCAT-server/lib/xcat/plugins/AAsn.pm @@ -1437,7 +1437,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; @@ -1475,24 +1475,10 @@ 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"); @@ -1507,13 +1493,22 @@ 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;