mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 19:32:31 +00:00 
			
		
		
		
	Merge pull request #6452 from cxhong/rinstall
modify nodeset return code for hierarchy support
This commit is contained in:
		| @@ -362,6 +362,8 @@ sub rinstall { | ||||
|         # We got an error with the nodeset | ||||
|         my @successnodes; | ||||
|         my @failurenodes; | ||||
|         my @failuresns; | ||||
|         my $snfailure; | ||||
|         # copy into a temporary variable to avoid of circular reference | ||||
|         my @lines = @$res; | ||||
|         foreach my $line (@lines) { | ||||
| @@ -384,19 +386,39 @@ sub rinstall { | ||||
|                 } | ||||
|                 return 1; | ||||
|             } | ||||
|  | ||||
|             if ($line =~ /Unable to dispatch hierarchical sub-command to (\S+):3001/) { | ||||
|                 $snfailure=1; | ||||
|                 push @failuresns,$1; | ||||
|             } | ||||
|             xCAT::MsgUtils->message("I", $rsp, $callback); | ||||
|         } | ||||
|  | ||||
|         # if only provision one node and failed nodeset, will exit the command | ||||
|         # instead of continue with rnetboot/rsetboot, rpower. | ||||
|         if (scalar(@nodes) == 1) { | ||||
|             $rsp->{error}->[0] = "Failed to run 'nodeset' against the node: @nodes"; | ||||
|             $rsp->{errorcode}->[0] = 1; | ||||
|             xCAT::MsgUtils->message("E", $rsp, $callback); | ||||
|             return 1; | ||||
|         if ( (scalar(@nodes) == 1) ) { | ||||
|             #exit the command if it's service node failure | ||||
|             if ($snfailure) { | ||||
|                 my $node = $nodes[0]; | ||||
|                 my $nrtab = xCAT::Table->new('noderes'); | ||||
|                 my $nrents = $nrtab->getNodeAttribs($node, [qw(servicenode)]); | ||||
|                 my $nodesn = $nrents->{servicenode}; | ||||
|                 foreach my $tmpsn (@failuresns) { | ||||
|                     if ($nodesn eq $tmpsn) { | ||||
|                         $rsp->{error}->[0] = "Unable connect to Service node $nodesn, failed to run 'nodeset' against the node: @nodes"; | ||||
|                         $rsp->{errorcode}->[0] = 1; | ||||
|                         xCAT::MsgUtils->message("E", $rsp, $callback); | ||||
|                         return 1; | ||||
|                     } | ||||
|                 } | ||||
|             } else { | ||||
|                 $rsp->{error}->[0] = "Failed to run 'nodeset' against the node: @nodes"; | ||||
|                 $rsp->{errorcode}->[0] = 1; | ||||
|                 xCAT::MsgUtils->message("E", $rsp, $callback); | ||||
|                 return 1; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|  | ||||
|         foreach my $node (@failurenodes) { | ||||
|             delete $nodes{$node}; | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user