diff --git a/xCAT-server/lib/xcat/plugins/xCATWorld.pm b/xCAT-server/lib/xcat/plugins/xCATWorld.pm index 230d525f5..45d0db910 100644 --- a/xCAT-server/lib/xcat/plugins/xCATWorld.pm +++ b/xCAT-server/lib/xcat/plugins/xCATWorld.pm @@ -47,32 +47,40 @@ sub handled_commands sub preprocess_request { my $req = shift; - my $cb = shift; + my $callback = shift; my %sn; - if ($req->{_xcatdest}) { return [$req]; } #exit if preprocessed + #if already preprocessed, go straight to request + if ($req->{_xcatpreprocessed}->[0] == 1 ) { return [$req]; } my $nodes = $req->{node}; my $service = "xcat"; # find service nodes for requested nodes # build an individual request for each service node - $sn = xCAT::Utils->get_ServiceNode($nodes, $service, "MN"); + if ($nodes) { + $sn = xCAT::Utils->get_ServiceNode($nodes, $service, "MN"); - # build each request for each service node + # build each request for each service node - foreach my $snkey (keys %$sn) - { + foreach my $snkey (keys %$sn) + { my $n=$sn->{$snkey}; print "snkey=$snkey, nodes=@$n\n"; my $reqcopy = {%$req}; $reqcopy->{node} = $sn->{$snkey}; $reqcopy->{'_xcatdest'} = $snkey; + $reqcopy->{_xcatpreprocessed}->[0] = 1; push @requests, $reqcopy; + } + return \@requests; + } else { # input error + my %rsp; + $rsp->{data}->[0] = "Input noderange missing. Useage: xCATWorld \n"; + xCAT::MsgUtils->message("I", $rsp, $callback, 0); + return 1; } - return \@requests; } - #------------------------------------------------------- =head3 process_request diff --git a/xCAT-server/lib/xcat/plugins/xdsh.pm b/xCAT-server/lib/xcat/plugins/xdsh.pm index a4e18c6eb..773aff0e5 100644 --- a/xCAT-server/lib/xcat/plugins/xdsh.pm +++ b/xCAT-server/lib/xcat/plugins/xdsh.pm @@ -55,7 +55,8 @@ sub preprocess_request my $cb = shift; my %sn; my $sn; - if ($req->{_xcatdest}) { return [$req]; } #exit if preprocessed + #if already preprocessed, go straight to request + if ($req->{_xcatpreprocessed}->[0] == 1 ) { return [$req]; } my $nodes = $req->{node}; my $service = "xcat"; my @requests; @@ -73,6 +74,7 @@ sub preprocess_request my $reqcopy = {%$req}; $reqcopy->{node} = $sn->{$snkey}; $reqcopy->{'_xcatdest'} = $snkey; + $reqcopy->{_xcatpreprocessed}->[0] = 1; push @requests, $reqcopy; }