diff --git a/mkAIXsnap b/mkAIXsnap index a381309bf..a3e92e925 100755 --- a/mkAIXsnap +++ b/mkAIXsnap @@ -44,7 +44,7 @@ fi # # do an update from the trunk directory level # -#svn update | tee $BLDTOP/coresvnup +svn update | tee $BLDTOP/coresvnup #svn update # create a simple install script diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 30f172afd..bf806297a 100644 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -9,7 +9,7 @@ use xCAT::Utils; =head1 xCAT::Usage =head2 Package Description xCAT usage module. Some commands such as rpower have different implementations - for different hardware. This module holds the usage usage string for these kind + for different hardware. This module holds the usage string for these kind of commands so that the usage can be referenced from different modules. =cut #------------------------------------------------------------------------------- @@ -187,8 +187,7 @@ sub parseCommand { #print "command=$command, args=@exargs, ARGV=@ARGV\n"; - $Getopt::Long::ignorecase=0; - $Getopt::Long::pass_through=1; + Getopt::Long::Configure('pass_through','no_ignore_case'); # parse the options if(!GetOptions( diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index e4f704e1a..8c1d21bcb 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -797,9 +797,11 @@ sub runcmd Arguments: command - string with following format: - where the xCAT cmd name is as reqistered in the plugins + where the xCAT cmd name is as reqistered in the plugins, the nodelist is already flattened and verified - the remainder of the string is passed as args + the remainder of the string is passed as args. + The nodelist may be set to the string "NO_NODE_RANGE" to + not pass in any nodes to the command. OR command - request hash @@ -834,6 +836,11 @@ sub runcmd If refoutput is true, then the output will be returned as a reference to an array for efficiency. + Do not use the scalar string input for xdsh unless you are running + a simple single-word command. When building your request hash, + the entire command string xdsh runs needs to be a single entry + in the arg array. + =cut @@ -853,13 +860,20 @@ sub runxcmd my $req; if (ref($cmd) eq "HASH") { $req = $cmd; - } else { # assume scalar - my ($cmdname,$nodelist,$cmdargs) = split(" ",$cmd); - my @nodes = split(",",$nodelist); - chomp $cmdargs; - $req={command=>[$cmdname], - node=>\@nodes, - arg=>[$cmdargs]}; + } else { # assume scalar, build request hash the way we do in xcatclient + my @cmdargs=split(/\s+/,$cmd); + my $cmdname = shift(@cmdargs); + $req->{command}=[$cmdname]; + my $arg=shift(@cmdargs); + while ($arg =~ /^-/) { + push (@{$req->{arg}}, $arg); + $arg=shift(@cmdargs); + } + if ($arg ne "NO_NODE_RANGE") { + my @nodes = split(",",$arg); + $req->{node}=\@nodes; + } + push (@{$req->{arg}}, @cmdargs); } $subreq->($req,\&runxcmd_output); $::CALLBACK = $save_CALLBACK; # in case the subreq call changed it @@ -889,16 +903,20 @@ sub runxcmd my $rsp={}; my $errmsg = join('', @$outref); chomp $errmsg; + my $displaycmd=$cmd; + if (ref($cmd) eq "HASH") { + $displaycmd=$cmd->{command}->[0]; + } if ($::CALLBACK) { $rsp->{data}->[0] = - "Command failed: $cmd. Error message: $errmsg.\n"; + "Command failed: $displaycmd. Error message: $errmsg.\n"; xCAT::MsgUtils->message("E", $rsp, $::CALLBACK); } else { xCAT::MsgUtils->message("E", - "Command failed: $cmd. Error message: $errmsg.\n"); + "Command failed: $displaycmd. Error message: $errmsg.\n"); } $xCAT::Utils::errno = 29; } diff --git a/xCAT-client/xCAT-client.spec b/xCAT-client/xCAT-client.spec index b2647d11a..b49a0868b 100644 --- a/xCAT-client/xCAT-client.spec +++ b/xCAT-client/xCAT-client.spec @@ -143,6 +143,7 @@ ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/mondecfg ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/monadd ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/monrm ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/sinv +ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/rollupdate ln -sf ../bin/xcatDBcmds $RPM_BUILD_ROOT/%{prefix}/bin/mkdsklsnode ln -sf ../bin/xcatDBcmds $RPM_BUILD_ROOT/%{prefix}/bin/rmdsklsnode ln -sf ../bin/xcatDBcmds $RPM_BUILD_ROOT/%{prefix}/bin/mknimimage diff --git a/xCAT-server/sbin/xcatd b/xCAT-server/sbin/xcatd index dc2e86937..ae7c77e78 100755 --- a/xCAT-server/sbin/xcatd +++ b/xCAT-server/sbin/xcatd @@ -243,6 +243,11 @@ if ($inet6support) { } print $conn "#END OF SCRIPT\n"; close($conn); + } elsif ($text =~ /^rebootnodes/) { + my @cmdargs = split(/\s+/,$text); + my $rebootcmd = shift(@cmdargs); + close($conn); + plugin_command({command=>[$rebootcmd],arg=>\@cmdargs,_xcat_clienthost=>[$node]},undef,\&build_response); } elsif ($text =~ /^setiscsiparms/) { $text =~ s/^setiscsiparms\s+//; my $kname;