mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-28 13:22:16 +00:00
fix(xcat-core): makedhcp drops the DHCPv6 boot file of an ipxe node without saying so
dhcp6_bootfile_url_for_node in dhcp.pm returned nothing when the UEFI loader was not under the tftpdir of the node, and reported nothing. The reservation was still written with its address and its DUID, makedhcp exited 0, and the node reached a firmware timeout with no line anywhere naming the file it had asked for. On an IPv6 cell that is the whole boot: there is no second method to fall back to. BootPolicy gains dhcp6_missing_loader_warning, which takes the tftpdir of the node and the loader name and returns the sentence or nothing. dhcp6_bootfile_url_for_node reports it through the callback, once per node per makedhcp, and then drops the boot file as before. Naming the node matters because the path comes from noderes.tftpdir, which the reader cannot derive from the site value. The three assertions the previous commit added to dhcp_dhcpv6_duid.t now pass, and the nine in dhcp_ipxe_readiness.t with them. Blanking the file check in the new sub fails five of those nine and leaves the four controls passing. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -878,6 +878,29 @@ sub upstream_loader_warnings {
|
||||
return @warnings;
|
||||
}
|
||||
|
||||
# Why one NODE gets no DHCPv6 boot file. dhcp6_bootfile_url_for_node drops the option when the
|
||||
# UEFI loader is not under the tftpdir of that node, and makedhcp exits 0, so the node reaches a
|
||||
# firmware timeout with nothing naming the file it asked for.
|
||||
#
|
||||
# upstream_loader_warnings cannot cover this. It reads the SITE TFTP directory and runs on
|
||||
# makedhcp -n and -a only, so a node with its own noderes.tftpdir is never examined, and
|
||||
# makedhcp <node> examines nothing.
|
||||
#
|
||||
# A node can load from another TFTP server, so this is a warning and not an error.
|
||||
sub dhcp6_missing_loader_warning {
|
||||
my ( $class, %opts ) = @_;
|
||||
|
||||
my $tftpdir = $opts{tftpdir};
|
||||
my $loader = $opts{loader};
|
||||
return unless defined $tftpdir && length $tftpdir;
|
||||
return unless defined $loader && length $loader;
|
||||
$tftpdir =~ s{/+$}{};
|
||||
return if -e "$tftpdir/$loader";
|
||||
return "$tftpdir/$loader is missing, so $opts{node} gets no DHCPv6 boot file and its"
|
||||
. " firmware times out with nothing to load. Install ipxe-xcat on the TFTP server"
|
||||
. " of $opts{node}.";
|
||||
}
|
||||
|
||||
# Whether this server has a loader that can SAN-boot an x86 node without iSCSI boot data: an
|
||||
# undionly.kpxe that the administrator put in the TFTP root, or the BIOS file of the loader of the
|
||||
# netboot method of the node.
|
||||
|
||||
@@ -71,6 +71,9 @@ my $nrhash;
|
||||
my $machash;
|
||||
my $dhcp6duids;
|
||||
my $dhcp6httpport;
|
||||
# The missing-loader warnings already reported in this makedhcp, keyed on the sentence, so a node
|
||||
# with several IPv6 NICs is named once.
|
||||
my %dhcp6_loader_warned;
|
||||
my $iscsients;
|
||||
my $nodetypeents;
|
||||
my $chainents;
|
||||
@@ -1921,6 +1924,7 @@ sub process_request
|
||||
$callback = shift;
|
||||
my $oldmask = umask 0077;
|
||||
$restartdhcp = 0;
|
||||
%dhcp6_loader_warned = ();
|
||||
my $rsp;
|
||||
|
||||
#print Dumper($req);
|
||||
@@ -4653,8 +4657,18 @@ sub dhcp6_bootfile_url_for_node
|
||||
return unless $loader;
|
||||
|
||||
# Naming a file the TFTP server does not have costs the client a timeout it cannot
|
||||
# diagnose, which is why the Kea client classes check the loader the same way.
|
||||
return if defined $boot_tftpdir && !-e "$boot_tftpdir/$loader";
|
||||
# diagnose, which is why the Kea client classes check the loader the same way. The node
|
||||
# is named rather than dropped in silence: the tftpdir of the node is not the site one,
|
||||
# so the reader cannot derive the path that was looked for.
|
||||
if ( my $missing = xCAT::DHCP::BootPolicy->dhcp6_missing_loader_warning(
|
||||
node => $node, tftpdir => $boot_tftpdir, loader => $loader ) )
|
||||
{
|
||||
# Once per node per makedhcp. A node with several IPv6 NICs reaches this for each of
|
||||
# them, and the same sentence repeated is noise that hides the rest of the output.
|
||||
$callback->({ node => [ { name => [$node], warning => [$missing] } ] })
|
||||
unless $dhcp6_loader_warned{$missing}++;
|
||||
return;
|
||||
}
|
||||
return "tftp://$uri_host/$loader";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user