mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-28 05:12:14 +00:00
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>
This commit is contained in:
@@ -33,11 +33,19 @@ vm_machine_type_private_dir()
|
||||
fi
|
||||
}
|
||||
|
||||
# vm_machine_type_for_arch <arch> [<vmothersetting>] -- 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
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user