From fee95d488267b0f35a5bc24ff4b74efc40414533 Mon Sep 17 00:00:00 2001 From: cxhong Date: Thu, 17 Oct 2019 17:48:59 -0400 Subject: [PATCH 1/2] modify nodeset return code for hierarchy support --- xCAT-server/lib/xcat/plugins/rinstall.pm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 2eed25a01..899e91c06 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -389,14 +389,18 @@ sub rinstall { # if only provision one node and failed nodeset, will exit the command # instead of continue with rnetboot/rsetboot, rpower. + # check if it is hierarchy cluster 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; + my $nrtab = xCAT::Table->new('noderes'); + my $sn = $nrtab->getNodeAttribs(@nodes,['servicenode']); + if (!$sn) { + $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}; } From fe4db25042ce5931a234eaaa85ff07a4bf783c62 Mon Sep 17 00:00:00 2001 From: cxhong Date: Fri, 18 Oct 2019 12:00:26 -0400 Subject: [PATCH 2/2] modify rinstall for service node error --- xCAT-server/lib/xcat/plugins/rinstall.pm | 28 +++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index 899e91c06..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,16 +386,32 @@ 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. - # check if it is hierarchy cluster - if (scalar(@nodes) == 1) { - my $nrtab = xCAT::Table->new('noderes'); - my $sn = $nrtab->getNodeAttribs(@nodes,['servicenode']); - if (!$sn) { + 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);