diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 2eed25a01..cc40b7b29 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -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}; }