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