add a new site attribute site.tftpflags which used to specify the tftpd parameters
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@13800 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		@@ -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".
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user