test: use firmware auto-detection with virt-install >= 4

3013889727

changed the behaviour of --boot uefi. Now, it doesn't pass the loader options
but uses firmware="efi" that uses libvirt's ability to auto-detect the correct
loader.

Therefore, for distributions that ship the new virt-install, we have to change
the --boot argument. --boot uefi should now be able to automatically set the
uefi loader correctly without passing any extra loader options. The only issue
is that CS9 has issues with secure boot and edge, so we need to disable
secure boot using a new (and arcane) syntax (the old loader arguments no
longer work):

firmware.feature0.name=secure-boot,firmware.feature0.enabled=no
(https://libvirt.org/formatdomain.html#bios-bootloader)

See the CS9 bug for secure boot issues on edge:

https://bugzilla.redhat.com/show_bug.cgi?id=2108646

Also, since --os-type is deprecated in libvirt >= 4, let's remove it.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2022-09-09 15:31:14 +02:00 committed by Tom Gundersen
parent c373d9971d
commit 966049ec3c

View file

@ -483,8 +483,21 @@ greenprint "👿 Running restorecon on image directory"
sudo restorecon -Rv /var/lib/libvirt/images/
greenprint "💿 Installing raw image on UEFI VM"
# TODO: os-type is deprecated in newer versions; remove conditionally
sudo virt-install --name="${IMAGE_KEY}-uefi"\
if nvrGreaterOrEqual "virt-install" "4"; then
sudo virt-install --name="${IMAGE_KEY}-uefi"\
--disk path="${LIBVIRT_IMAGE_PATH}",format=qcow2 \
--ram 3072 \
--vcpus 2 \
--network network=integration,mac=34:49:22:B0:83:31 \
--import \
--os-variant ${OS_VARIANT} \
--boot uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no \
--nographics \
--noautoconsole \
--wait=-1 \
--noreboot
else
sudo virt-install --name="${IMAGE_KEY}-uefi"\
--disk path="${LIBVIRT_IMAGE_PATH}",format=qcow2 \
--ram 3072 \
--vcpus 2 \
@ -497,6 +510,7 @@ sudo virt-install --name="${IMAGE_KEY}-uefi"\
--noautoconsole \
--wait=-1 \
--noreboot
fi
# Start VM.
greenprint "💻 Start UEFI VM"