From 1ab2f68a32f386ea486dcddb5b256927ba578a40 Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 21 Oct 2026 17:55:15 -0300 Subject: [PATCH] fix(xcattest): the diskless case takes a UEFI node to i440fx reg_linux_diskless_installation_flat asks vm_machine_type.sh for a valid machine type, and the helper answers machine:pc for every x86_64 node. A node with firmware:efi then cannot boot: libvirt refuses a UEFI firmware on i440fx, rpower boot fails and the case reports a provision failure that has nothing to do with provisioning. vm_machine_type_for_arch now reads the vmothersetting it saved and answers machine:q35 for an x86_64 node that asks for a UEFI firmware. An x86_64 node without one still gets machine:pc. vm_machine_type.bats covers both, and a mutation that answers machine:pc for a UEFI node turns the two new tests red. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- .../testcase/commoncmd/vm_machine_type.sh | 12 +++++++++-- xCAT-test/bats/vm_machine_type.bats | 21 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/xCAT-test/autotest/testcase/commoncmd/vm_machine_type.sh b/xCAT-test/autotest/testcase/commoncmd/vm_machine_type.sh index 412a16c771..93b198aabd 100755 --- a/xCAT-test/autotest/testcase/commoncmd/vm_machine_type.sh +++ b/xCAT-test/autotest/testcase/commoncmd/vm_machine_type.sh @@ -33,11 +33,19 @@ vm_machine_type_private_dir() fi } +# vm_machine_type_for_arch [] -- the machine type to apply. +# An x86_64 node that asks for a UEFI firmware takes q35: every x86_64 OVMF descriptor targets +# pc-q35-*, and libvirt refuses firmware efi on i440fx. vm_machine_type_for_arch() { case "$1" in ppc64*) echo 'machine:pseries-rhel7.6.0' ;; - x86_64) echo 'machine:pc' ;; + x86_64) + case ";$2" in + *';firmware:efi'*) echo 'machine:q35' ;; + *) echo 'machine:pc' ;; + esac + ;; riscv64) echo 'machine:virt' ;; aarch64) echo 'machine:virt' ;; *) return 1 ;; @@ -109,7 +117,7 @@ vm_machine_type_apply() chdef "$node" "vmothersetting=$original" return fi - if ! machine="$(vm_machine_type_for_arch "$arch")"; then + if ! machine="$(vm_machine_type_for_arch "$arch" "$original")"; then echo "vm_machine_type.sh: no machine type for arch '$arch'" >&2 return 1 fi diff --git a/xCAT-test/bats/vm_machine_type.bats b/xCAT-test/bats/vm_machine_type.bats index 22480c09ed..427393085e 100644 --- a/xCAT-test/bats/vm_machine_type.bats +++ b/xCAT-test/bats/vm_machine_type.bats @@ -79,6 +79,27 @@ assert_arch() assert_arch x86_64 pc 'cpumode:host-passthrough' } +# An x86_64 node that asks for UEFI needs q35: every x86_64 OVMF descriptor targets pc-q35-*, +# and libvirt refuses a domain that asks for firmware efi on i440fx with "Unable to find 'efi' +# firmware that is compatible with the current configuration". +@test "x86_64 with firmware:efi: the case sets and clears q35" { + assert_arch x86_64 q35 'firmware:efi' + assert_arch x86_64 q35 'cpumode:host-passthrough;firmware:efi' +} + +@test "x86_64 with firmware:efi-secureboot: the case sets and clears q35" { + assert_arch x86_64 q35 'firmware:efi-secureboot' + assert_arch x86_64 q35 'cpumode:host-passthrough;firmware:efi-secureboot' +} + +@test "x86_64 without a firmware: the case still sets pc" { + assert_arch x86_64 pc 'cpumode:host-passthrough' +} + +@test "round trip: x86_64 with firmware:efi-secureboot" { + assert_round_trip x86_64 'cpumode:host-passthrough;firmware:efi-secureboot' +} + @test "riscv64: the case sets and clears virt" { assert_arch riscv64 virt '' assert_arch riscv64 virt 'cpumode:host-passthrough'