new variables to check for preprocess already run

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2914 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2009-03-16 13:24:16 +00:00
parent 7e5fa15591
commit eba4025eb1
2 changed files with 19 additions and 9 deletions

View File

@ -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 <noderange> \n";
xCAT::MsgUtils->message("I", $rsp, $callback, 0);
return 1;
}
return \@requests;
}
#-------------------------------------------------------
=head3 process_request

View File

@ -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;
}