diff --git a/xCAT-client/bin/rinstall b/xCAT-client/bin/rinstall index 9d989a2e7..789222ba3 100755 --- a/xCAT-client/bin/rinstall +++ b/xCAT-client/bin/rinstall @@ -21,6 +21,7 @@ use Getopt::Long; use xCAT::MsgUtils; use xCAT::Utils; use xCAT::Client; +use xCAT::NodeRange; use Cwd; use strict; @@ -65,15 +66,23 @@ while ($arg =~ /^-/) { $cmdref->{noderange}->[0] = $arg; push(@{ $cmdref->{arg} }, @ARGV); +my $startconsole=0; +if(grep m/^-c|--console$/,@ARGV){ + $startconsole=1; +} + my $noderange = $cmdref->{noderange}->[0]; # save the noderange +my @noderange=xCAT::NodeRange::noderange($noderange); + +if($bname eq "rinstall" and $startconsole==1 and scalar @noderange!=1 ){ + xCAT::MsgUtils->message("E", "Error: rinstall can only be run against one node! Please use winstall for multiple nodes."); + exit 1; +} # ok call Client to run the plugin rinstall.pm xCAT::Client::submit_request($cmdref, \&xCAT::Client::handle_response); - if ($xCAT::Client::EXITCODE == 0) # no errors { - my $startconsole = $cmdref->{startconsole}->[0]; - # if startconsole requested ( -c flag) for rinstall always for winstall # This is set in the rinstall plugin if ($startconsole == 1) { @@ -82,9 +91,7 @@ if ($xCAT::Client::EXITCODE == 0) # no errors exec("rcons $noderange"); } elsif (basename($0) =~ /winstall/) { - # winstall can commence a wcons command to the noderange for monitoring the provision cycle - exec("wcons $noderange"); } } diff --git a/xCAT-server/lib/xcat/plugins/rinstall.pm b/xCAT-server/lib/xcat/plugins/rinstall.pm index ea2f0003a..787fbc63d 100644 --- a/xCAT-server/lib/xcat/plugins/rinstall.pm +++ b/xCAT-server/lib/xcat/plugins/rinstall.pm @@ -335,6 +335,7 @@ sub rinstall { $rsp->{data}->[0] = "Provision node(s): @nodes"; xCAT::MsgUtils->message("I", $rsp, $callback); } + %nodes = map { $_, 1 } @nodes; # Run nodeset $noderange $parameter @@ -355,8 +356,8 @@ sub rinstall { push @{ $rsp->{data} }, @$res; xCAT::MsgUtils->message("D", $rsp, $callback); } - unless ($rc == 0) { + unless ($rc == 0) { # We got an error with the nodeset my @successnodes; my @failurenodes; @@ -364,12 +365,8 @@ sub rinstall { my @lines = @$res; foreach my $line (@lines) { $rsp->{data}->[0] = $line; - if (($line =~ /: install/) or ($line =~ /: netboot/)) { - my $successnode; - my $restline; - ($successnode, $restline) = split(/:/, $line, 2); - $nodes{$successnode} = 0; - push @successnodes, $successnode; + if($line =~ /The (\S+) can not be resolved/){ + push @failurenodes,$1; } if ($line =~ /dhcp server is not running/) { my $rsp = {}; @@ -380,18 +377,18 @@ sub rinstall { } xCAT::MsgUtils->message("I", $rsp, $callback); } - foreach my $node (@nodes) { - if ($nodes{$node} == 1) { - push @failurenodes, $node; - } + + foreach my $node (@failurenodes) { + delete $nodes{$node}; } + my $rsp = {}; if (0+@failurenodes > 0) { $rsp->{error}->[0] = "Failed to run 'nodeset' against the following nodes: @failurenodes"; $rsp->{errorcode}->[0] = 1; xCAT::MsgUtils->message("E", $rsp, $callback); } - @nodes = @successnodes; + @nodes = keys %nodes; } # Group the nodes according to the nodehm.mgt @@ -591,30 +588,6 @@ sub rinstall { } } - # Check if they asked to bring up a console (-c) from rinstall always for winstall - $req->{startconsole}->[0] = 0; - if ($command =~ /rinstall/) { - - # For rinstall, the -c|--console option can provide the remote console for only 1 node - if ($CONSOLE) { - if (scalar @nodes != 1) { - my $rsp = {}; - $rsp->{error}->[0] = "rinstall -c only accepts one node in the noderange. See winstall for support of consoles on multiple nodes."; - $rsp->{errorcode}->[0] = 1; - xCAT::MsgUtils->message("E", $rsp, $callback); - return 1; - } - else { - # Tell rinstall client ok to start rcons - $req->{startconsole}->[0] = 1; - } - } - } - elsif ($command =~ /winstall/) { - - # Command winstall can start a wcons command to multiple nodes for monitoring the provision cycle - $req->{startconsole}->[0] = 1; - } return 0; }