From 0f87fd2a003afdb394d931b6362f79ab82a6c52f 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, 27 Sep 2026 02:11:36 -0300 Subject: [PATCH] fix(destiny): test the SAN loader of the netboot method of each node setdestiny accepted an x86 iscsiboot node without iSCSI boot data only when undionly.kpxe was in the TFTP root. The check read -f ("$tftpdir/undionly.kpxe" or -f "$tftpdir/xcat/xnba.kpxe"): the or was inside the -f argument, so xnba.kpxe never counted. Accept the node when undionly.kpxe is there, or the BIOS file of the loader of its netboot method: the upstream loader for netboot=ipxe, and xNBA for any other method. --- perl-xCAT/xCAT/DHCP/BootPolicy.pm | 12 ++++++++++++ xCAT-server/lib/xcat/plugins/destiny.pm | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/perl-xCAT/xCAT/DHCP/BootPolicy.pm b/perl-xCAT/xCAT/DHCP/BootPolicy.pm index e017045c7..f1f764ac3 100644 --- a/perl-xCAT/xCAT/DHCP/BootPolicy.pm +++ b/perl-xCAT/xCAT/DHCP/BootPolicy.pm @@ -852,6 +852,18 @@ sub upstream_loader_warnings { return @warnings; } +# 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. +sub x86_san_loader_present { + my ( $class, %opts ) = @_; + + my $tftpdir = $opts{tftpdir} // '/tftpboot'; + $tftpdir =~ s{/+$}{}; + my $loader = $class->x86_loader( method => $opts{method} ); + return ( -f "$tftpdir/undionly.kpxe" || -f "$tftpdir/$loader->{bios}" ) ? 1 : 0; +} + # The ISC host statements that choose the boot file of a node with netboot ipxe, xnba or pxe. They # reach dhcpd through omshell, so their quotes are escaped. sub isc_node_boot_statements { diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index 6c33617f0..ea5114ea1 100644 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -14,6 +14,7 @@ use xCAT::TableUtils; use Sys::Syslog; use xCAT::GlobalDef; use xCAT::Table; +use xCAT::DHCP::BootPolicy; use xCAT_monitoring::monitorctrl; use Getopt::Long; use strict; @@ -234,11 +235,15 @@ sub setdestiny { my $nodetype = xCAT::Table->new('nodetype'); my $ntents = $nodetype->getNodesAttribs($req->{node}, [qw(os arch profile)]); my $ients = $iscsitab->getNodesAttribs($req->{node}, [qw(kernel kcmdline initrd)]); + my $noderes = xCAT::Table->new('noderes'); + my $nrents = $noderes ? $noderes->getNodesAttribs($req->{node}, ['netboot']) : {}; foreach (@{ $req->{node} }) { my $ient = $ients->{$_}->[0]; #$iscsitab->getNodeAttribs($_,[qw(kernel kcmdline initrd)]); my $ntent = $ntents->{$_}->[0]; unless ($ient and $ient->{kernel}) { - unless ($ntent and $ntent->{arch} =~ /x86/ and -f ("$tftpdir/undionly.kpxe" or -f "$tftpdir/xcat/xnba.kpxe")) { + my $netboot = $nrents->{$_} && $nrents->{$_}->[0] ? $nrents->{$_}->[0]->{netboot} : undef; + unless ($ntent and $ntent->{arch} =~ /x86/ + and xCAT::DHCP::BootPolicy->x86_san_loader_present(tftpdir => $tftpdir, method => $netboot)) { $failurenodes{$_} = 1; xCAT::MsgUtils->report_node_error($callback, $_, "No iscsi boot data available"); } #If x86 node and undionly.kpxe exists, presume they know what they are doing