mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-29 13:52:20 +00:00
fix(xcat-core): a node found by sequential discovery gets no DHCPv6 reservation
findme assigned a node and recorded its MAC, its address, its BMC, its position, its groups and its chain, and never recorded the UUID the request carries. dhcp6_client_duids builds the DHCPv6 identity of a node from vpd.uuid, so makedhcp fell back to a DUID-LL derived from the MAC. None of the three boot stages sends a DUID-LL, so the reservation matched nothing and the node kept an address from the pool, which xcatd cannot map back to it. The node is discovered and then cannot be provisioned at the address it was given. findme now records the UUID through xCAT::DiscoveryUtils::vpd_attribs_from_findme, which takes the SMBIOS form only. The OpenEmbedded image synthesises "<machine type>-<serial>-<first mac>" when the firmware reports no product_uuid, and a DUID built from that string would match no client either. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -214,4 +214,39 @@ sub _first_value {
|
||||
return $name;
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
||||
=head3 vpd_attribs_from_findme
|
||||
|
||||
The vpd attributes a findme request carries for the node it discovers.
|
||||
|
||||
Arguments:
|
||||
the findme request
|
||||
Returns:
|
||||
a hash reference of vpd attributes, empty when the request carries none
|
||||
|
||||
=cut
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
sub vpd_attribs_from_findme
|
||||
{
|
||||
my $request = shift;
|
||||
if ( defined($request) && !ref($request) && $request eq __PACKAGE__ )
|
||||
{
|
||||
$request = shift;
|
||||
}
|
||||
return {} unless ref($request) eq 'HASH';
|
||||
|
||||
my $uuid = $request->{uuid};
|
||||
$uuid = $uuid->[0] if ref($uuid) eq 'ARRAY';
|
||||
return {} unless defined($uuid);
|
||||
|
||||
# The OpenEmbedded image synthesises "<machine type>-<serial>-<first mac>" when the firmware
|
||||
# reports no product_uuid. dhcp6_client_duids builds a DUID-UUID from this value, and a DUID
|
||||
# built from that string matches no client, so only the SMBIOS form is recorded.
|
||||
return {} unless $uuid =~ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
||||
|
||||
return { uuid => lc($uuid) };
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@@ -282,6 +282,20 @@ sub findme {
|
||||
$sitetab->close();
|
||||
}
|
||||
|
||||
# dhcp6_client_duids builds the DHCPv6 identity of a node from vpd.uuid, and there is
|
||||
# no other table holding it. Without this the reservation falls back to a DUID-LL built
|
||||
# from the MAC, which no boot stage of the node sends, and the node takes a pool address
|
||||
# that xcatd cannot map back to it.
|
||||
my $vpdattribs = xCAT::DiscoveryUtils->vpd_attribs_from_findme($request);
|
||||
if ( keys %{$vpdattribs} ) {
|
||||
my $vpdtab = xCAT::Table->new( 'vpd', -create => 1 );
|
||||
if ($vpdtab) {
|
||||
$vpdtab->setNodeAttribs( $node, $vpdattribs );
|
||||
} else {
|
||||
xCAT::MsgUtils->message( "S", "Discovery Error: Could not open table: vpd." );
|
||||
}
|
||||
}
|
||||
|
||||
#set the groups for the node
|
||||
my $nltab = xCAT::Table->new('nodelist');
|
||||
unless ($nltab) {
|
||||
|
||||
Reference in New Issue
Block a user