From 42e8ef64cc86cb41a195f70a410ac23f5e95ed5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Ferr=C3=A3o?= <2031761+viniciusferrao@users.noreply.github.com> Date: Mon, 27 Jul 2026 15:22:12 -0300 Subject: [PATCH] fix(xnba): warn only when pxelinux is required MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Vinícius Ferrão <2031761+viniciusferrao@users.noreply.github.com> --- xCAT-server/lib/xcat/plugins/xnba.pm | 38 +++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 5a2b8e92a..68a729f16 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -91,6 +91,14 @@ sub getstate { } } +sub _requires_pxelinux { + my $kern = shift; + return 0 unless ($kern and ref($kern) eq 'HASH'); + + my $kernel = $kern->{kernel} || ''; + return ($kernel =~ /!/ or $kernel =~ /\.c32\z/ or $kernel =~ /memdisk\z/) ? 1 : 0; +} + my %efistubcache; sub has_efistub { my $kern = shift; @@ -285,6 +293,7 @@ sub setstate { close($pcfg); _write_uefi_exit_script($bootloader_root, $node, $cref->{currstate}); } elsif ($kern and $kern->{kernel}) { + $::XNBA_pxelinux_required = 1 if (_requires_pxelinux($kern)); if ($kern->{kernel} =~ /!/) { #TODO: deprecate this, do stateless Xen like stateless ESXi my $hypervisor; my $kernel; @@ -610,6 +619,7 @@ sub process_request { $::XNBA_callback = shift; my $sub_req = shift; undef $::XNBA_addkcmdlinehandled; # clear out any previous value + undef $::XNBA_pxelinux_required; my @args; my @rnodes; undef %failurenodes; @@ -760,21 +770,6 @@ sub process_request { } } - #back to normal business - if (!-r "$globaltftpdir/xcat/pxelinux.0") { - if (-r $::XCATROOT . "/share/xcat/netboot/syslinux/pxelinux.0") { - copy($::XCATROOT . "/share/xcat/netboot/syslinux/pxelinux.0", "$globaltftpdir/xcat/pxelinux.0"); - chmod(0644, "$globaltftpdir/xcat/pxelinux.0"); - } - } - unless (-r "$globaltftpdir/xcat/pxelinux.0") { - # only legacy BIOS clients chain pxelinux, and not every distribution - # still ships syslinux, so warn instead of failing the whole request - $::XNBA_callback->({ warning => ["Unable to find pxelinux.0 from syslinux, legacy BIOS nodes that chain pxelinux will not boot until it is available"] }); - } - - - my $inittime = 0; if (exists($::XNBA_request->{inittime})) { $inittime = $::XNBA_request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } @@ -843,6 +838,19 @@ sub process_request { } } } + + if ($::XNBA_pxelinux_required) { + if (!-r "$globaltftpdir/xcat/pxelinux.0") { + if (-r $::XCATROOT . "/share/xcat/netboot/syslinux/pxelinux.0") { + copy($::XCATROOT . "/share/xcat/netboot/syslinux/pxelinux.0", "$globaltftpdir/xcat/pxelinux.0"); + chmod(0644, "$globaltftpdir/xcat/pxelinux.0"); + } + } + unless (-r "$globaltftpdir/xcat/pxelinux.0") { + $::XNBA_callback->({ warning => ["Unable to find pxelinux.0 from syslinux; nodes whose xNBA configuration chains pxelinux will not boot until it is available"] }); + } + } + xCAT::MsgUtils->trace($verbose_on_off, "d", "xnba: Finish to handle configurations"); #dhcp stuff -- inittime is set when xcatd on sn is started