This test case demonstrates how to force libvirt to use the uefi-vars device for an x86_64 guest, despite that not being the default firmware build for the architecture at this point in time.
It currently fails because the QEMU driver does not yet allow the use of JSON for NVRAM. That will change in a future commit. In addition to the latest version, the test case is also executed against QEMU 8.2.0 specifically. This version of the test case is intended to fail, because the uefi-vars device was not yet available in that version of QEMU. The exact error message will change down the line. Signed-off-by: Andrea Bolognani <[email protected]> --- ...uto-efi-format-nvram-json.x86_64-8.2.0.err | 1 + ...uto-efi-format-nvram-json.x86_64-8.2.0.xml | 35 +++++++++++++++++++ ...to-efi-format-nvram-json.x86_64-latest.err | 1 + ...to-efi-format-nvram-json.x86_64-latest.xml | 35 +++++++++++++++++++ .../firmware-auto-efi-format-nvram-json.xml | 18 ++++++++++ tests/qemuxmlconftest.c | 2 ++ 6 files changed, 92 insertions(+) create mode 100644 tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-8.2.0.err create mode 100644 tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-8.2.0.xml create mode 100644 tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-latest.err create mode 100644 tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.xml diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-8.2.0.err b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-8.2.0.err new file mode 100644 index 0000000000..e5f67f8d09 --- /dev/null +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-8.2.0.err @@ -0,0 +1 @@ +unsupported configuration: Unsupported nvram format 'json' diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-8.2.0.xml b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-8.2.0.xml new file mode 100644 index 0000000000..cc7fdfad79 --- /dev/null +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-8.2.0.xml @@ -0,0 +1,35 @@ +<domain type='kvm'> + <name>guest</name> + <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>1</vcpu> + <os firmware='efi'> + <type arch='x86_64' machine='pc-q35-8.2'>hvm</type> + <nvram format='json'/> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0' model='none'/> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pcie-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <audio id='1' type='none'/> + <watchdog model='itco' action='reset'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-latest.err b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-latest.err new file mode 100644 index 0000000000..e5f67f8d09 --- /dev/null +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-latest.err @@ -0,0 +1 @@ +unsupported configuration: Unsupported nvram format 'json' diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-latest.xml b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-latest.xml new file mode 100644 index 0000000000..cc7fdfad79 --- /dev/null +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.x86_64-latest.xml @@ -0,0 +1,35 @@ +<domain type='kvm'> + <name>guest</name> + <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>1</vcpu> + <os firmware='efi'> + <type arch='x86_64' machine='pc-q35-8.2'>hvm</type> + <nvram format='json'/> + <boot dev='hd'/> + </os> + <features> + <acpi/> + </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>qemu64</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' index='0' model='none'/> + <controller type='sata' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/> + </controller> + <controller type='pci' index='0' model='pcie-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <audio id='1' type='none'/> + <watchdog model='itco' action='reset'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.xml b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.xml new file mode 100644 index 0000000000..8c7a268910 --- /dev/null +++ b/tests/qemuxmlconfdata/firmware-auto-efi-format-nvram-json.xml @@ -0,0 +1,18 @@ +<domain type='kvm'> + <name>guest</name> + <uuid>63840878-0deb-4095-97e6-fc444d9bc9fa</uuid> + <memory unit='KiB'>1048576</memory> + <vcpu placement='static'>1</vcpu> + <os firmware='efi'> + <type arch='x86_64' machine='pc-q35-8.2'>hvm</type> + <nvram format='json'/> + </os> + <features> + <acpi/> + </features> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <controller type='usb' model='none'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 85c35af515..a109ae99d6 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -1630,6 +1630,8 @@ mymain(void) DO_TEST_CAPS_LATEST("firmware-auto-efi-format-nvramtemplate-qcow2"); DO_TEST_CAPS_LATEST("firmware-auto-efi-format-mismatch"); DO_TEST_CAPS_LATEST_FAILURE("firmware-auto-efi-format-mismatch-nvramtemplate"); + DO_TEST_CAPS_LATEST_FAILURE("firmware-auto-efi-format-nvram-json"); + DO_TEST_CAPS_VER_FAILURE("firmware-auto-efi-format-nvram-json", "8.2.0"); /* This test passes, but the outcome is not the desired one: the * generic edk2 build gets selected instead of the AMD SEV one */ -- 2.52.0
