From 097554ba34d3aa7bae9f1cbf370f28a24677557e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Sun, 23 Aug 2026 13:56:22 -0300 Subject: [PATCH] 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. --- xCAT-server/lib/xcat/plugins/blade.pm | 38 +++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 085043051..02f65004d 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -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'];