Add hierarchical intelligence to pxe and paboot plugins

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@333 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-01-27 20:45:31 +00:00
parent 0bf19030af
commit 6a492166e4
2 changed files with 67 additions and 0 deletions

View File

@ -124,6 +124,39 @@ sub pass_along {
sub preprocess_request {
my $req = shift;
my $callback = shift;
my %localnodehash;
my %dispatchhash;
my $nrtab = xCAT::Table->new('noderes');
foreach my $node (@{$req->{node}}) {
my $nodeserver;
my $tent = $nrtab->getNodeAttribs($node,['tftpserver']);
if ($tent) { $nodeserver = $tent->{tftpserver} }
unless ($tent and $tent->{tftpserver}) {
$tent = $nrtab->getNodeAttribs($node,['servicenode']);
if ($tent) { $nodeserver = $tent->{servicenode} }
}
if ($nodeserver) {
$dispatchhash{$nodeserver}->{$node} = 1;
} else {
$localnodehash{$node} = 1;
}
}
my @requests;
my $reqc = {%$req};
$reqc->{node} = [ keys %localnodehash ];
if (scalar(@{$reqc->{node}})) { push @requests,$reqc }
foreach my $dtarg (keys %dispatchhash) { #iterate dispatch targets
my $reqcopy = {%$req}; #deep copy
$reqcopy->{'_xcatdest'} = $dtarg;
$reqcopy->{node} = [ keys %{$dispatchhash{$dtarg}}];
push @requests,$reqcopy;
}
return \@requests;
}
sub process_request {
$request = shift;

View File

@ -124,6 +124,40 @@ sub pass_along {
}
sub preprocess_request {
my $req = shift;
my $callback = shift;
my %localnodehash;
my %dispatchhash;
my $nrtab = xCAT::Table->new('noderes');
foreach my $node (@{$req->{node}}) {
my $nodeserver;
my $tent = $nrtab->getNodeAttribs($node,['tftpserver']);
if ($tent) { $nodeserver = $tent->{tftpserver} }
unless ($tent and $tent->{tftpserver}) {
$tent = $nrtab->getNodeAttribs($node,['servicenode']);
if ($tent) { $nodeserver = $tent->{servicenode} }
}
if ($nodeserver) {
$dispatchhash{$nodeserver}->{$node} = 1;
} else {
$localnodehash{$node} = 1;
}
}
my @requests;
my $reqc = {%$req};
$reqc->{node} = [ keys %localnodehash ];
if (scalar(@{$reqc->{node}})) { push @requests,$reqc }
foreach my $dtarg (keys %dispatchhash) { #iterate dispatch targets
my $reqcopy = {%$req}; #deep copy
$reqcopy->{'_xcatdest'} = $dtarg;
$reqcopy->{node} = [ keys %{$dispatchhash{$dtarg}}];
push @requests,$reqcopy;
}
return \@requests;
}