2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-10-12 08:12:33 +00:00

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.
This commit is contained in:
Vinícius Ferrão
2026-09-27 02:11:36 -03:00
parent ac94a62696
commit 0f87fd2a00
2 changed files with 18 additions and 1 deletions
+12
View File
@@ -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 {
+6 -1
View File
@@ -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