From 26b3a62c049e74e0f0a8f2d5ba09de8d366bc6a4 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sun, 8 Nov 2026 15:52:08 -0300 Subject: [PATCH 1/2] test(xcat-core): Genesis waits for an IPv4 address that an IPv6 cell never serves The provisioning network of an IPv6 cell declares an IPv4 subnet with no pool, so Kea answers every DHCPv4 request with ALLOC_ENGINE_V4_ALLOC_FAIL_NO_POOLS and the node holds no IPv4 address. doxcat waits for one with no bound, and Genesis never reaches xcatd. The bats case gives the boot nic an IPv6 address and no IPv4 address, and expects doxcat to finish. Before the change doxcat does not return and the sandbox timeout reports 124. The sandbox stub for "ip -4" now reads a per-nic file when the test writes one, and answers as before when it does not. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-test/bats/genesis_secondary_dhcp6_order.bats | 8 ++++++++ xCAT-test/bats/helpers/doxcat_sandbox.bash | 11 ++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/xCAT-test/bats/genesis_secondary_dhcp6_order.bats b/xCAT-test/bats/genesis_secondary_dhcp6_order.bats index bea823d78f..b9b5fb583b 100644 --- a/xCAT-test/bats/genesis_secondary_dhcp6_order.bats +++ b/xCAT-test/bats/genesis_secondary_dhcp6_order.bats @@ -63,3 +63,11 @@ dhcp6_nics() [ "$status" -eq 0 ] [ "$output" = 2 ] } + +@test "the boot nic finishes net init with an IPv6 address and no IPv4 address" { + # The provisioning network of an IPv6 cell declares no IPv4 pool, so no IPv4 address can + # arrive. doxcat has to go on with the address it has, or Genesis never reaches xcatd. + : >"$fixture/addrs4/boot0" + printf '2: boot0 inet6 2001:db8:188::20/64 scope global\n' >"$fixture/addrs6/boot0" + boot_genesis +} diff --git a/xCAT-test/bats/helpers/doxcat_sandbox.bash b/xCAT-test/bats/helpers/doxcat_sandbox.bash index 2abe3dc9d7..b909bad2ef 100644 --- a/xCAT-test/bats/helpers/doxcat_sandbox.bash +++ b/xCAT-test/bats/helpers/doxcat_sandbox.bash @@ -9,7 +9,7 @@ setup_doxcat() local utility fips library fips=$(repo_path xCAT-genesis-scripts/usr/lib/xcat/fips.sh) [ -r "$fips" ] - mkdir -p "$fixture"/{etc/ssh,etc/pki/tls,real,links,addrs,addrs6} + mkdir -p "$fixture"/{etc/ssh,etc/pki/tls,real,links,addrs,addrs4,addrs6} # chmod is in this list because doxcat runs it: the sandbox has no /usr/bin on PATH, so a # command that is missing here is a command that silently does nothing under test. doxcat's # chmod of the sshd privilege separation directory was not exercised until it was added. @@ -56,10 +56,15 @@ case "$*" in '-o addr show dev '*) [ ! -e "/run/fixture/addrs/$5.fail" ] || exit 19 cat "/run/fixture/addrs/$5" ;; - '-6 -o addr show dev '*) + '-6 -o a show dev '*|'-6 -o addr show dev '*) [ ! -e "/run/fixture/addrs6/$6.fail" ] || exit 19 cat "/run/fixture/addrs6/$6" ;; - '-4 -o a show dev '*) printf '2: %s inet 192.0.2.20/24 scope global\n' "$6" ;; + '-4 -o a show dev '*|'-4 -o addr show dev '*) + if [ -e "/run/fixture/addrs4/$6" ]; then + cat "/run/fixture/addrs4/$6" + else + printf '2: %s inet 192.0.2.20/24 scope global\n' "$6" + fi ;; *) printf 'unexpected ip %s\n' "$*" >&2; exit 97 ;; esac SH From 251f334a54e8d8faef357326dc1221ed840df14f Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Sun, 8 Nov 2026 15:52:08 -0300 Subject: [PATCH 2/2] fix(xcat-core): Genesis waits for an IPv4 address that an IPv6 cell never serves Genesis booted on the el10 x86_64 IPv6 cell, started its DHCP clients and then did nothing for the rest of the case. No findme, no credential request and no status update reached xcatd, and the node stayed out of the shell. doxcat ended net init on the boot nic with a wait for an IPv4 address and no bound. An IPv6 provisioning network declares an IPv4 subnet with no pool, so Kea refuses every DHCPv4 request and the wait never ends. The wait now ends when the boot nic holds an address of either family, in genesis_nic_has_address, because xcatd is reached over whichever family the network serves. The message after it names the family that arrived. The pSeries branch, which runs when BOOTIF is absent, still reads IPv4 only. It is bounded by its own try count and is not changed here. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-genesis-scripts/usr/bin/doxcat | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/xCAT-genesis-scripts/usr/bin/doxcat b/xCAT-genesis-scripts/usr/bin/doxcat index 0779158165..8636887321 100755 --- a/xCAT-genesis-scripts/usr/bin/doxcat +++ b/xCAT-genesis-scripts/usr/bin/doxcat @@ -238,6 +238,18 @@ genesis_nic_has_global_v6() { ip -6 -o addr show dev "$nic" 2>/dev/null | grep -v 'scope link' | grep -q inet6 } +genesis_nic_has_global_v4() { + local nic="$1" + ip -4 -o addr show dev "$nic" 2>/dev/null | grep -v 'scope link' | grep -q inet +} + +# xcatd is reached over whichever family the provisioning network serves, so net init is over +# when the boot nic holds an address of either one. +genesis_nic_has_address() { + local nic="$1" + genesis_nic_has_global_v4 "$nic" || genesis_nic_has_global_v6 "$nic" +} + # Wait for one nic to hold a routable IPv6 address. Returns non-zero after the last try, which # on an IPv4-only network is every time. genesis_wait_nic_v6() { @@ -417,10 +429,10 @@ else gripeiter=101 logger -s -t $log_label -p local4.info "Acquiring network addresses.." - while ! ip -4 -o a show dev $bootnic|grep -v 'scope link'|grep -q inet; do + while ! genesis_nic_has_address "$bootnic"; do sleep 0.1 if [ $gripeiter = 1 ]; then - logger -s -t $log_label -p local4.info "It seems to be taking a while to acquire an IPv4 address, you may want to check spanning tree..." + logger -s -t $log_label -p local4.info "It seems to be taking a while to acquire an address, you may want to check spanning tree..." fi gripeiter=$((gripeiter-1)) done @@ -432,9 +444,13 @@ touch /tmp/netinitted openssl genrsa -out /etc/xcat/certkey.pem 4096 > /dev/null 2>&1 & -logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic" - -ip -4 -o a show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|awk '{print $4}' +if genesis_nic_has_global_v4 "$bootnic"; then + logger -s -t $log_label -p local4.info "Acquired IPv4 address on $bootnic" + ip -4 -o addr show dev $bootnic|grep -v 'scope link'|grep -v 'dynamic'|awk '{print $4}' +else + logger -s -t $log_label -p local4.info "Acquired IPv6 address on $bootnic" + ip -6 -o addr show dev $bootnic|grep -v 'scope link'|awk '{print $4}' +fi if [ -e /usr/sbin/ntpd ]; then logger -s -t $log_label -p local4.info "Starting ntpd..."