From 0136c51a18a258ed96318285b7bf8688e49cbda0 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Fri, 4 Sep 2026 10:16:16 -0300 Subject: [PATCH] fix(mknb): a Genesis copy that fails must fail mknb The legacy branch ran both copies and kept only the second exit status, so an unreadable Genesis root tree left mknb exiting 0 with an initramfs built from nothing -- the node then never boots and nothing names the cause. A failing kernel copy was reported as a failure of the root tree, because the message was chosen from a flag set before either copy ran. Return on the first failing copy, carrying the name of the file that could not be read. mknb_genesis_staging.t goes from 2 failures to green on this commit. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> (cherry picked from commit d46ca3e09bf52827bf0b8fa9cb94279a9da2c97b) --- xCAT-server/lib/xcat/plugins/mknb.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index be6ab48fc..f84c099c1 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -354,9 +354,13 @@ sub stage_genesis_payload { my $run = $a{run} || sub { return system($_[0]); }; my $rc; if (($a{genesis_type} // '') eq 'legacy') { + # Two copies, each able to fail on its own. Return on the first, so neither the exit + # status nor the name of the unreadable file is lost to the one that follows it. $rc = $run->("shopt -s dotglob; GLOBIGNORE=\".:..\" cp -a $a{genesis_dir}/fs/* $a{tempdir}"); + return ($rc, "$a{genesis_dir}/fs") if $rc; $rc = $run->("cp -a $a{genesis_dir}/kernel $a{tftpdir}/xcat/genesis.kernel.$a{arch}"); - return ($rc, "$a{genesis_dir}/fs"); + return ($rc, "$a{genesis_dir}/kernel") if $rc; + return (0, undef); } $rc = $run->("cp -a $a{genesis_dir}/nbroot/* $a{tempdir}"); return ($rc, "$a{genesis_dir}/nbroot");