mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-04 20:17:55 +00:00
fix(blade): ask only the blades of a chassis for a discovery inventory
The findme handler of the blade plugin makes an inventory request for each node in the mp table. That table holds more than the blades of a chassis. lsslp writes a row for a Power BMC, for an FSP, for a BPA, for an HMC and for other hardware, and xCAT::PPCdb::add_systemX writes a row for a management module. None of that hardware answers a blade inventory. Keep a row that gives blade as its hardware type. Keep also a row that gives no hardware type but names a different node as its mpa, when that other node is a management module. The mp template in xCAT/templates/e1350 leaves the hardware type of a blade empty, so a test of the hardware type alone loses the blades of a chassis. Return when the table holds no blades. The work below the filter reads the arp table of the management node, and a site that has no chassis must not pay for that on each discovery request. Recovered from the lenovobuild branch, which tested the hardware type only.
This commit is contained in:
@@ -4365,6 +4365,35 @@ sub verbose_message {
|
||||
xCAT::MsgUtils->message("I", \%rsp, $CALLBACK);
|
||||
}
|
||||
|
||||
sub blade_nodes_from_mp {
|
||||
my @entries = @_;
|
||||
my %hwtype;
|
||||
my %ownmpa;
|
||||
foreach my $entry (@entries) {
|
||||
next unless defined $entry->{node};
|
||||
$hwtype{ $entry->{node} } = defined $entry->{nodetype} ? lc($entry->{nodetype}) : q{};
|
||||
$hwtype{ $entry->{node} } =~ s/^\s+|\s+$//gx;
|
||||
$ownmpa{ $entry->{node} } = $entry->{mpa} if defined $entry->{mpa};
|
||||
}
|
||||
my @blades;
|
||||
foreach my $entry (@entries) {
|
||||
my $node = $entry->{node};
|
||||
next unless defined $node;
|
||||
if ($hwtype{$node} eq 'blade') {
|
||||
push @blades, $node;
|
||||
next;
|
||||
}
|
||||
next if $hwtype{$node} ne q{};
|
||||
my $chassis = $ownmpa{$node};
|
||||
next if not defined $chassis or $chassis eq $node;
|
||||
next if $hwtype{$chassis} ne 'mm'
|
||||
and $hwtype{$chassis} ne 'cmm'
|
||||
and not(defined $ownmpa{$chassis} and $ownmpa{$chassis} eq $chassis);
|
||||
push @blades, $node;
|
||||
}
|
||||
return @blades;
|
||||
}
|
||||
|
||||
sub process_request {
|
||||
$SIG{INT} = $SIG{TERM} = sub {
|
||||
foreach (keys %mm_comm_pids) {
|
||||
@@ -4479,11 +4508,10 @@ sub process_request {
|
||||
|
||||
my $mptab = xCAT::Table->new("mp");
|
||||
unless ($mptab) { return 2; }
|
||||
my @bladents = $mptab->getAllNodeAttribs([qw(node)]);
|
||||
my @blades;
|
||||
foreach (@bladents) {
|
||||
push @blades, $_->{node};
|
||||
}
|
||||
my @bladents = $mptab->getAllNodeAttribs([qw(node nodetype mpa)]);
|
||||
my @blades = blade_nodes_from_mp(@bladents);
|
||||
|
||||
unless (@blades) { return; }
|
||||
my %invreq;
|
||||
$invreq{node} = \@blades;
|
||||
$invreq{arg} = ['mac,uuid'];
|
||||
|
||||
Reference in New Issue
Block a user