mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-30 02:42:41 +00:00 
			
		
		
		
	* Fix issue #2794, Nodeset fails to generate /tftpboot config files if ip attribute is not set - Report error when the node cannot be handled by its xcatmaster/servicenode (sharedtftp=0) * - using determinehostname to get the current server name, it will reduce the time when many service nodes.
This commit is contained in:
		| @@ -513,11 +513,31 @@ sub process_request { | ||||
|     #if not shared tftpdir, then filter, otherwise, set up everything | ||||
|     if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command | ||||
|         @nodes = (); | ||||
|         my @hostinfo = xCAT::NetworkUtils->determinehostname(); | ||||
|         my $cur_xmaster = pop @hostinfo; | ||||
|         xCAT::MsgUtils->trace(0, "d", "xnba: running on $cur_xmaster"); | ||||
|  | ||||
|         # Get current server managed node list | ||||
|         my $sn_hash = xCAT::ServiceNodeUtils->getSNformattedhash(\@rnodes, "xcat", "MN"); | ||||
|         my %managed = {}; | ||||
|         foreach (@{ $sn_hash->{$cur_xmaster} }) { $managed{$_} = 1; } | ||||
|  | ||||
|         foreach (@rnodes) { | ||||
|             if (xCAT::NetworkUtils->nodeonmynet($_)) { | ||||
|                 push @nodes, $_; | ||||
|             } else { | ||||
|                 xCAT::MsgUtils->message("S", "$_: grub2 netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster."); | ||||
|                 my $msg = "grub2 configuration file was not created for node [$_] because sharedtftp attribute is not set and the node is not on same network as this xcatmaster"; | ||||
|                 if ( $cur_xmaster ) { | ||||
|                     $msg .= ": $cur_xmaster"; | ||||
|                 } | ||||
|                 if ( exists( $managed{$_} ) ) { | ||||
|                     # report error when it is under my control but I cannot handle it. | ||||
|                     my $rsp; | ||||
|                     $rsp->{data}->[0] = $msg; | ||||
|                     xCAT::MsgUtils->message("E", $rsp, $callback); | ||||
|                 } else { | ||||
|                     xCAT::MsgUtils->message("S", $msg); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } else { | ||||
|   | ||||
| @@ -404,11 +404,31 @@ sub process_request { | ||||
|     #if not shared tftpdir, then filter, otherwise, set up everything | ||||
|     if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command | ||||
|         @nodes = (); | ||||
|         my @hostinfo = xCAT::NetworkUtils->determinehostname(); | ||||
|         my $cur_xmaster = pop @hostinfo; | ||||
|         xCAT::MsgUtils->trace(0, "d", "xnba: running on $cur_xmaster"); | ||||
|  | ||||
|         # Get current server managed node list | ||||
|         my $sn_hash = xCAT::ServiceNodeUtils->getSNformattedhash(\@rnodes, "xcat", "MN"); | ||||
|         my %managed = {}; | ||||
|         foreach (@{ $sn_hash->{$cur_xmaster} }) { $managed{$_} = 1; } | ||||
|  | ||||
|         foreach (@rnodes) { | ||||
|             if (xCAT::NetworkUtils->nodeonmynet($_)) { | ||||
|                 push @nodes, $_; | ||||
|             } else { | ||||
|                 xCAT::MsgUtils->message("S", "$_: petitboot netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster."); | ||||
|                 my $msg = "petitboot configuration file was not created for node [$_] because sharedtftp attribute is not set and the node is not on same network as this xcatmaster"; | ||||
|                 if ( $cur_xmaster ) { | ||||
|                     $msg .= ": $cur_xmaster"; | ||||
|                 } | ||||
|                 if ( exists( $managed{$_} ) ) { | ||||
|                     # report error when it is under my control but I cannot handle it. | ||||
|                     my $rsp; | ||||
|                     $rsp->{data}->[0] = $msg; | ||||
|                     xCAT::MsgUtils->message("E", $rsp, $callback); | ||||
|                 } else { | ||||
|                     xCAT::MsgUtils->message("S", $msg); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } else { | ||||
|   | ||||
| @@ -449,11 +449,33 @@ sub process_request { | ||||
|     #if not shared, then help sync up | ||||
|     if ($::XNBA_request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command | ||||
|         @nodes = (); | ||||
|         my @hostinfo = xCAT::NetworkUtils->determinehostname(); | ||||
|         my $cur_xmaster = pop @hostinfo; | ||||
|         xCAT::MsgUtils->trace(0, "d", "xnba: running on $cur_xmaster"); | ||||
|          | ||||
|         # Get current server managed node list | ||||
|         my $sn_hash = xCAT::ServiceNodeUtils->getSNformattedhash(\@rnodes, "xcat", "MN"); | ||||
|         my %managed = {}; | ||||
|         foreach (@{ $sn_hash->{$cur_xmaster} }) { $managed{$_} = 1; } | ||||
|  | ||||
|         # Whatever the node managed by this xcatmaster explicitly, if the node in same subnet, we need to handle its boot configuration files | ||||
|         foreach (@rnodes) { | ||||
|             if (xCAT::NetworkUtils->nodeonmynet($_)) { | ||||
|                 push @nodes, $_; | ||||
|             } else { | ||||
|                 xCAT::MsgUtils->message("S", "$_: xnba netboot: stop configuration because of none sharedtftp and not on same network with its xcatmaster."); | ||||
|                 my $msg = "xnba configuration file was not created for node [$_] because sharedtftp attribute is not set and the node is not on same network as this xcatmaster"; | ||||
|                 if ( $cur_xmaster ) {  | ||||
|                     $msg .= ": $cur_xmaster";  | ||||
|                 } | ||||
|                 if ( exists( $managed{$_} ) ) { | ||||
|                     # report error when it is under my control but I cannot handle it. | ||||
|                     my $rsp; | ||||
|                     $rsp->{data}->[0] = $msg; | ||||
|                     xCAT::MsgUtils->message("E", $rsp, $::XNBA_callback); | ||||
|                 } else { | ||||
|                     xCAT::MsgUtils->message("S", $msg); | ||||
|                 } | ||||
|  | ||||
|             } | ||||
|         } | ||||
|     } else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user