handles hierarchy using _preprossed flag for some commands
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3803 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
cbf5b2d000
commit
4745d80859
@ -35,6 +35,9 @@ sub preprocess_request
|
||||
{
|
||||
my $req = shift;
|
||||
my $callback = shift;
|
||||
#if already preprocessed, go straight to request
|
||||
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
|
||||
|
||||
if ($req->{command}->[0] eq 'copycd')
|
||||
{ #don't farm out copycd
|
||||
return [$req];
|
||||
@ -84,6 +87,7 @@ sub preprocess_request
|
||||
{ #iterate dispatch targets
|
||||
my $reqcopy = {%$req}; #deep copy
|
||||
$reqcopy->{'_xcatdest'} = $dtarg;
|
||||
$reqcopy->{_xcatpreprocessed}->[0] = 1;
|
||||
$reqcopy->{node} = [keys %{$dispatchhash{$dtarg}}];
|
||||
push @requests, $reqcopy;
|
||||
}
|
||||
|
@ -35,7 +35,8 @@ sub handled_commands {
|
||||
|
||||
sub preprocess_request {
|
||||
my $request = shift;
|
||||
if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
||||
#if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
||||
if ($request->{_xcatpreprocessed}->[0] == 1) { return [$request]; }
|
||||
my $callback=shift;
|
||||
my @requests;
|
||||
my $noderange = $request->{node}; #Should be arrayref
|
||||
@ -114,6 +115,7 @@ sub preprocess_request {
|
||||
if (!$isSN) { #
|
||||
my $reqcopy = {%$request};
|
||||
$reqcopy->{'_xcatdest'} = $master;
|
||||
$reqcopy->{_xcatpreprocessed}->[0] = 1;
|
||||
$reqcopy->{'_allnodes'} = $allnodes; # the original command comes with nodes or not
|
||||
if ($allnodes==1) { @nodes=(); }
|
||||
$reqcopy->{node} = \@nodes;
|
||||
@ -134,6 +136,7 @@ sub preprocess_request {
|
||||
if ($doit) {
|
||||
my $reqcopy = {%$request};
|
||||
$reqcopy->{'_xcatdest'} = $cons;
|
||||
$reqcopy->{_xcatpreprocessed}->[0] = 1;
|
||||
$reqcopy->{'_allnodes'} = [$allnodes]; # the original command comes with nodes or not
|
||||
$reqcopy->{node} = $cons_hash{$cons}{nodes};
|
||||
my $no=$reqcopy->{node};
|
||||
|
@ -63,6 +63,8 @@ sub preprocess_request
|
||||
my $callback = shift;
|
||||
my $command = $req->{command}->[0];
|
||||
# if ($req->{_xcatdest}) { return [$req]; } #exit if preprocessed
|
||||
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
|
||||
|
||||
if ($req->{module}) { return [$req]; }
|
||||
my $args=$req->{arg};
|
||||
|
||||
@ -142,6 +144,7 @@ sub preprocess_request
|
||||
if (! $iphash{$sv}) {
|
||||
if ($isSV) { next; } #if the command is issued on the monserver, only handle its children.
|
||||
$reqcopy->{'_xcatdest'}=$sv;
|
||||
$reqcopy->{_xcatpreprocessed}->[0] = 1;
|
||||
my $rsp2={};
|
||||
$rsp2->{data}->[0]="sending request to $sv..., ".join(',', @$mon_nodes);
|
||||
$callback->($rsp2);
|
||||
|
@ -58,7 +58,10 @@ sub preprocess_request
|
||||
my $callback = shift;
|
||||
my $subreq = shift;
|
||||
my $command = $request->{command}->[0];
|
||||
if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
||||
#if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
||||
#if already preprocessed, go straight to request
|
||||
if ($request->{_xcatpreprocessed}->[0] == 1) { return [$request]; }
|
||||
|
||||
my @requests=();
|
||||
|
||||
if ($command eq "updatenode")
|
||||
@ -237,6 +240,8 @@ sub preprocess_updatenode {
|
||||
my $reqcopy = {%$request};
|
||||
$reqcopy->{node} = $sn->{$snkey};
|
||||
$reqcopy->{'_xcatdest'} = $snkey;
|
||||
$reqcopy->{_xcatpreprocessed}->[0] = 1;
|
||||
|
||||
if (defined ($::SWMAINTENANCE)) {
|
||||
$reqcopy->{swmaintenance} = "yes";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user