diff --git a/docs/source/advanced/mixed_cluster/power/diskless.rst b/docs/source/advanced/mixed_cluster/power/diskless.rst index 88ca74a9b..09f0fb9ba 100644 --- a/docs/source/advanced/mixed_cluster/power/diskless.rst +++ b/docs/source/advanced/mixed_cluster/power/diskless.rst @@ -4,12 +4,11 @@ Provision x86 Diskless Troubleshooting --------------- -**Error:** The following Error message comes out when running nodeset: :: +**Warning:** The following warning appears when ``nodeset`` generates a configuration that chains pxelinux: :: - Error: Unable to find pxelinux.0 at /opt/xcat/share/xcat/netboot/syslinux/pxelinux.0 + Warning: Unable to find pxelinux.0 from syslinux; nodes whose xNBA configuration chains pxelinux will not boot until it is available **Resolution:** The syslinux network booting files are missing. -Install the sylinux-xcat package provided in the xcat-deps repository: ``yum -y install syslinux-xcat`` - +Install the syslinux-xcat package provided in the xcat-deps repository: ``yum -y install syslinux-xcat`` diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 12d0d41d4..2e314e02f 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; @@ -286,6 +294,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; @@ -611,6 +620,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; @@ -761,22 +771,6 @@ sub process_request { } } - #back to normal business - if (!-r "$globaltftpdir/xcat/pxelinux.0") { - unless (-r $::XCATROOT . "/share/xcat/netboot/syslinux/pxelinux.0") { - $::XNBA_callback->({ error => [ "Unable to find pxelinux.0 at " . $::XCATROOT . "/share/xcat/netboot/syslinux/pxelinux.0" ], errorcode => [1] }); - return; - } - 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->({ error => ["Unable to find pxelinux.0 from syslinux"], errorcode => [1] }); - return; - } - - - my $inittime = 0; if (exists($::XNBA_request->{inittime})) { $inittime = $::XNBA_request->{inittime}->[0]; } if (!$inittime) { $inittime = 0; } @@ -845,6 +839,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 diff --git a/xCAT-test/unit/xnba_semicolon.t b/xCAT-test/unit/xnba_semicolon.t index fdf998526..abcc8411e 100644 --- a/xCAT-test/unit/xnba_semicolon.t +++ b/xCAT-test/unit/xnba_semicolon.t @@ -34,4 +34,18 @@ like($src, qr/sub _use_efistub_for_uefi\b/, 'UEFI EFI-stub selection helper exis like($src, qr/sles\?11/, 'SLES 11 UEFI compatibility rule matches sle11 and sles11 images'); like($src, qr/if \(_use_efistub_for_uefi\(\$kern\)\)/, 'UEFI boot path uses compatibility helper before direct EFI-stub boot'); +# pxelinux is only needed for multiboot, COMBOOT, and memdisk configurations. +# Missing syslinux must not warn for ordinary direct-kernel nodeset requests. +like($src, qr/sub _requires_pxelinux\b/, 'pxelinux requirement helper exists'); +like( + $src, + qr/\$::XNBA_pxelinux_required = 1 if \(_requires_pxelinux\(\$kern\)\)/, + 'generated boot configuration records when pxelinux is required' +); +like( + $src, + qr/if \(\$::XNBA_pxelinux_required\) \{.*?Unable to find pxelinux\.0/s, + 'missing pxelinux warning is limited to requests that generate a pxelinux chain' +); + done_testing();