2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-20 17:32:15 +00:00

fix(xcat-core): rinstall reports a nodeset failure although nodeset succeeded

rinstall prints "Failed to run 'nodeset' against the node: <node>" and returns
1, while nodeset against the same node exits 0 and reports no error. rinstall
returns before rnetboot and rpower, so the node is never powered on and every
provisioning case waits for a machine that nobody booted.

xCAT::Utils::runxcmd returns $::RUNCMD_RC. runxcmd_output ORs the errorcode of
each response into that global, and xCAT::Utils::runcmd and the service helpers
assign their own exit status to it, so the last command of any plugin in the
subrequest replaces the result. makedhcp supplies that command: its ISC branch
restarts dhcpd6 whenever /etc/dhcp/dhcpd6.conf is absent or written by another
program, which is every run of a cluster with no IPv6 network, and the restart
fails with no subnet to serve. A Kea cell restarts kea-dhcp6 only for a run
that has DHCPv6 work, so only ISC cells fail.

runxcmd now collects the errorcodes in $::xcmd_errorcode and assigns that to
$::RUNCMD_RC after the subrequest, so a command of the subrequest can neither
set nor clear the result. dhcp6_restart_needed restarts dhcpd6 only for a run
that serves an IPv6 network.

runxcmd_subrequest_errorcode.t and dhcp_isc_dhcp6_restart.t fail on the parent
commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-11-07 07:22:32 -03:00
parent b999334d1a
commit f38c6cd33d
2 changed files with 16 additions and 6 deletions
+4 -1
View File
@@ -43,7 +43,10 @@ sub implemented {
sub dhcp6_restart_needed {
my ( $class, %args ) = @_;
return $args{changed} ? 1 : 0;
# xCAT writes the dhcpd6 configuration only for an IPv6 network. Without one the file
# stays absent, which the caller reads as a configuration to replace, and dhcpd6 has no
# subnet to serve.
return ( $args{changed} and $args{ipv6} ) ? 1 : 0;
}
1;
+12 -5
View File
@@ -1332,6 +1332,7 @@ sub runxcmd
}
$::xcmd_outref = [];
$::xcmd_errorcode = 0;
%::xcmd_outref_hash = ();
my $req;
if (ref($cmd) eq "HASH")
@@ -1374,6 +1375,12 @@ sub runxcmd
$::CALLBACK = $save_CALLBACK; # in case the subreq call changed it
$::callback = $save_callback; # To keep $::callback also since some module use this global variable
# The result of the subrequest is the errorcode of its responses. Every plugin it reaches
# runs commands of its own, and runcmd and the service helpers assign the exit status of
# each one to $::RUNCMD_RC, so the global holds the last command of the subrequest and not
# its result.
$::RUNCMD_RC = $::xcmd_errorcode;
if ($::RUNCMD_RC)
{
my $displayerror = 1;
@@ -1519,7 +1526,7 @@ sub runxcmd_output
{
if (ref(\($node->{errorcode}->[0])) eq 'SCALAR')
{
$::RUNCMD_RC |= $node->{errorcode}->[0];
$::xcmd_errorcode |= $node->{errorcode}->[0];
}
}
push @$::xcmd_outref, $desc;
@@ -1539,14 +1546,14 @@ sub runxcmd_output
{
foreach my $ecode (@{ $resp->{errorcode} })
{
$::RUNCMD_RC |= $ecode;
$::xcmd_errorcode |= $ecode;
}
}
else
{
# assume it is a non-reference scalar
$::RUNCMD_RC |= $resp->{errorcode};
$::xcmd_errorcode |= $resp->{errorcode};
}
}
@@ -1596,14 +1603,14 @@ sub runxcmd_output2
push @{ $::xcmd_outref_hash->{errorcode} }, @{ $resp->{errorcode} };
foreach my $ecode (@{ $resp->{errorcode} })
{
$::RUNCMD_RC |= $ecode;
$::xcmd_errorcode |= $ecode;
}
}
else
{
# assume it is a non-reference scalar
$::RUNCMD_RC |= $resp->{errorcode};
$::xcmd_errorcode |= $resp->{errorcode};
}
}
return 0;