mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-09-03 08:48:23 +00:00
Allow restricting service node pools
Service node pools would go as far as the network allowed. Honor the servicenode attribute to limit visibility to the service nodes that are relevant and any owner of a dynamic range. Also allow execution if the dhcp server is not running (e.g. shutting down dhcp server on the master node to allow only the service nodes to provide services).
This commit is contained in:
@@ -990,7 +990,8 @@ sub check_options
|
||||
#my @output = xCAT::Utils->runcmd("service $DHCPSERVER status", -1);
|
||||
#if ($::RUNCMD_RC != 0) { # not running
|
||||
my $ret = 0;
|
||||
$ret = xCAT::Utils->checkservicestatus("dhcp");
|
||||
# If dhcp is shut off on a master node, then it may still be valid... for now
|
||||
#$ret = xCAT::Utils->checkservicestatus("dhcp");
|
||||
if ($ret != 0)
|
||||
{
|
||||
my $rsp = {};
|
||||
@@ -1302,6 +1303,53 @@ sub preprocess_request
|
||||
my $reqcopy = {%$req};
|
||||
$reqcopy->{'_xcatdest'} = $entries[0];
|
||||
push @requests, $reqcopy;
|
||||
} else {
|
||||
my $nettab = xCAT::Table->new('networks');
|
||||
my @nets = $nettab->getAllAttribs('dhcpserver');
|
||||
my @dhcpservers;
|
||||
foreach (@nets) {
|
||||
if ($_->{dhcpserver}) {
|
||||
push @dhcpservers, $_->{dhcpserver};
|
||||
}
|
||||
}
|
||||
my %localnodehash;
|
||||
my %dispatchhash;
|
||||
my $nrtab = xCAT::Table->new('noderes');
|
||||
my $nrents = $nrtab->getNodesAttribs($req->{node}, [qw(tftpserver servicenode)]);
|
||||
foreach my $node (@{ $req->{node} })
|
||||
{
|
||||
my $nodeserver;
|
||||
my $tent = $nrents->{$node}->[0]; #$nrtab->getNodeAttribs($node, ['tftpserver']);
|
||||
if ($tent) { $nodeserver = $tent->{tftpserver} }
|
||||
unless ($tent and $tent->{tftpserver})
|
||||
{
|
||||
$tent = $nrents->{$node}->[0]; #$nrtab->getNodeAttribs($node, ['servicenode']);
|
||||
if ($tent) { $nodeserver = $tent->{servicenode} }
|
||||
}
|
||||
if ($nodeserver)
|
||||
{
|
||||
foreach my $ns (split /,/, $nodeserver) {
|
||||
$dispatchhash{$ns}->{$node} = 1;
|
||||
}
|
||||
}
|
||||
$localnodehash{$node} = 1;
|
||||
}
|
||||
my @requests;
|
||||
my $reqc = {%$req};
|
||||
foreach my $dhcps (@dhcpservers) {
|
||||
my $reqcopy = {%$req}; #deep copy
|
||||
$reqcopy->{'_xcatdest'} = $dhcps;
|
||||
$reqcopy->{node} = [ keys %localnodehash ];
|
||||
if (scalar(@{ $reqcopy->{node} })) { push @requests, $reqcopy }
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
foreach my $s (@snlist)
|
||||
@@ -1317,6 +1365,7 @@ sub preprocess_request
|
||||
}
|
||||
|
||||
|
||||
|
||||
#print Dumper(@requests);
|
||||
return \@requests;
|
||||
|
||||
|
Reference in New Issue
Block a user