From f207c33777d95a1e2216fb6b3d3a62b2aded8ead Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Fri, 11 Sep 2026 10:40:17 -0300 Subject: [PATCH] fix(provtest,dhcptest): refuse a second setup over a live fixture Both fixtures record what they are about to change so teardown can put it back, and both truncated that record on entry. A setup run while one was already up therefore saved the fixture's own site table, dhcpd.conf and /etc/hosts as the originals, and the veth and namespace it no longer knew about survived the teardown that followed. Refuse when the state directory is there, naming the teardown to run. --- xCAT-test/autotest/testcase/dhcptest/dhcpfixture.sh | 4 ++++ xCAT-test/autotest/testcase/provtest/provfixture.sh | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/xCAT-test/autotest/testcase/dhcptest/dhcpfixture.sh b/xCAT-test/autotest/testcase/dhcptest/dhcpfixture.sh index 503b29af7..47f400b51 100755 --- a/xCAT-test/autotest/testcase/dhcptest/dhcpfixture.sh +++ b/xCAT-test/autotest/testcase/dhcptest/dhcpfixture.sh @@ -301,6 +301,10 @@ do_check() { } do_setup() { + # A second setup over a live fixture would save the fixture's own dhcpd.conf + # and site table as the originals, so teardown would restore them instead of + # what was there first. Refuse rather than leave the machine in that state. + [ -d "$STATE" ] && die "a fixture is already up; run '$0 teardown' first" mkdir -p "$STATE" || die "cannot create $STATE" # Recorded before it is changed, so teardown is exact rather than a guess. diff --git a/xCAT-test/autotest/testcase/provtest/provfixture.sh b/xCAT-test/autotest/testcase/provtest/provfixture.sh index fbfa78696..77ca62965 100755 --- a/xCAT-test/autotest/testcase/provtest/provfixture.sh +++ b/xCAT-test/autotest/testcase/provtest/provfixture.sh @@ -463,6 +463,11 @@ define_node() { do_setup() { local tmpl http dns tftp + # A second setup over a live fixture would overwrite the record teardown + # restores from -- the site table, /etc/hosts, the name server's + # configuration -- and orphan the veth and the namespace it no longer knows + # about. Refuse rather than leave the machine in that state. + [ -d "$STATE" ] && die "a fixture is already up; run '$0 teardown' first" mkdir -p "$STATE" || die "cannot create $STATE" : > "$STATE/files"; : > "$STATE/dirs" : > "$STATE/nodes"; : > "$STATE/osimages"; : > "$STATE/services"