diff --git a/perl-xCAT/xCAT/DHCP/BootPolicy.pm b/perl-xCAT/xCAT/DHCP/BootPolicy.pm index f7b216503f..99a9bc0403 100644 --- a/perl-xCAT/xCAT/DHCP/BootPolicy.pm +++ b/perl-xCAT/xCAT/DHCP/BootPolicy.pm @@ -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 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. diff --git a/xCAT-server/lib/xcat/plugins/dhcp.pm b/xCAT-server/lib/xcat/plugins/dhcp.pm index 561bf77ba0..f89b450787 100644 --- a/xCAT-server/lib/xcat/plugins/dhcp.pm +++ b/xCAT-server/lib/xcat/plugins/dhcp.pm @@ -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"; }