diff --git a/perl-xCAT/xCAT/DiscoveryUtils.pm b/perl-xCAT/xCAT/DiscoveryUtils.pm index 4da07036a0..d7aa7067dd 100644 --- a/perl-xCAT/xCAT/DiscoveryUtils.pm +++ b/perl-xCAT/xCAT/DiscoveryUtils.pm @@ -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 "--" 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; diff --git a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm index 625c4e8828..75e1a45393 100644 --- a/xCAT-server/lib/xcat/plugins/seqdiscovery.pm +++ b/xCAT-server/lib/xcat/plugins/seqdiscovery.pm @@ -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) {