mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 11:22:27 +00:00 
			
		
		
		
	-Fix nodeset at tftp setup time, and prevent makedhcp from farming out when nodeset was already farmed out
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3032 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -965,7 +965,7 @@ sub setup_TFTP | ||||
|                   } | ||||
|                 } | ||||
|                 $cmdref->{command}->[0] = "nodeset"; | ||||
|                 $cmdref->{localonly}->[0] = "1"; | ||||
|                 $cmdref->{inittime}->[0] = "1"; | ||||
|                 $cmdref->{arg}->[0] = "enact"; | ||||
|                 $cmdref->{cwd}->[0]     = "/opt/xcat/sbin"; | ||||
|                 my $plugins_dir=$::XCATROOT.'/lib/perl/xCAT_plugin'; | ||||
|   | ||||
| @@ -12,6 +12,7 @@ use Sys::Syslog; | ||||
| use IPC::Open2; | ||||
| use xCAT::Utils; | ||||
| use xCAT::NodeRange; | ||||
| use Fcntl ':flock'; | ||||
|  | ||||
| my @dhcpconf; #Hold DHCP config file contents to be written back. | ||||
| my @nrn;      # To hold output of networks table to be consulted throughout process | ||||
| @@ -428,6 +429,9 @@ sub process_request | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|    my $dhcplockfd; | ||||
|    open($dhcplockfd,"/tmp/xcat/dhcplock"); | ||||
|    flock($dhcplockfd,LOCK_EX); | ||||
|    if (grep /^-n$/, @{$req->{arg}}) | ||||
|     { | ||||
|         if (-e "/etc/dhcpd.conf") | ||||
| @@ -637,6 +641,7 @@ sub process_request | ||||
|         system("/etc/init.d/dhcpd restart"); | ||||
|         system("chkconfig dhcpd on"); | ||||
|     } | ||||
|     flock($dhcplockfd,LOCK_UN); | ||||
|     umask $oldmask; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -189,7 +189,7 @@ sub preprocess_request { | ||||
|    my $sent = $stab->getAttribs({key=>'sharedtftp'},'value'); | ||||
|    if ($sent and ($sent->{value} == 0 or $sent->{value} =~ /no/i)) { | ||||
|       $req->{'_disparatetftp'}=[1]; | ||||
|       if ($req->{localonly}->[0]) { | ||||
|       if ($req->{inittime}->[0]) { | ||||
|           return [$req]; | ||||
|       } | ||||
|       return xCAT::Scope->get_broadcast_scope($req,@_); | ||||
| @@ -341,9 +341,9 @@ sub process_request { | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   unless ($sub_req) { return; } #Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time | ||||
|   if ($request->{inittime}->[0]) { return; } #Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time | ||||
|   if ($args[0] ne 'stat') { | ||||
|   if ($req->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command | ||||
|   if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command | ||||
|     $sub_req->({command=>['makedhcp'],arg=>['-l'], | ||||
|            node=>\@nodes},$callback); | ||||
|   } else { | ||||
|   | ||||
| @@ -191,7 +191,7 @@ sub preprocess_request { | ||||
|    my $sent = $stab->getAttribs({key=>'sharedtftp'},'value'); | ||||
|    if ($sent and ($sent->{value} == 0 or $sent->{value} =~ /no/i)) { | ||||
|       $req->{'_disparatetftp'}=[1]; | ||||
|       if ($req->{localonly}->[0]) { | ||||
|       if ($req->{inittime}->[0]) { | ||||
|           return [$req]; | ||||
|       } | ||||
|       return xCAT::Scope->get_broadcast_scope($req,@_); | ||||
| @@ -322,9 +322,9 @@ sub process_request { | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   unless ($sub_req) { return; } #Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time | ||||
|   if ($request->{inittime}->[0]) { return; } #Don't bother to try dhcp binding changes if sub_req not passed, i.e. service node build time | ||||
|   my @normalnodeset = keys %normalnodes; | ||||
|   if ($req->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed | ||||
|   if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command, only change local settings if already farmed | ||||
|   $sub_req->({command=>['makedhcp'],arg=>['-l'], | ||||
|            node=>\@normalnodeset},$callback); | ||||
|   } else { | ||||
| @@ -332,7 +332,7 @@ sub process_request { | ||||
|            node=>\@normalnodeset},$callback); | ||||
|   } | ||||
|   my @breaknetboot=keys %breaknetbootnodes; | ||||
|   if ($req->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command | ||||
|   if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command | ||||
|     $sub_req->({command=>['makedhcp'], | ||||
|          node=>\@breaknetboot, | ||||
|          arg=>['-l','-s','filename = \"xcat/nonexistant_file_to_intentionally_break_netboot_for_localboot_to_work\";']},$callback); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user