At this point, the QEMU driver is ready to correctly handle
NVRAM files in JSON format, so we can lift the restriction that
has existed until now.

The firmware-manual-efi-qemuvars-q35 test case now passes, since
all the necessary information was already provided in the domain
XML and the driver actively rejecting use of JSON was the only
thing getting in the way.

The firmware-auto-efi-format-nvram-json test case still fails
because there are still no firmware descriptors that match the
requested configuration. That will change in a future commit.

https://issues.redhat.com/browse/RHEL-82645

Signed-off-by: Andrea Bolognani <[email protected]>
---
 src/qemu/qemu_firmware.c                      |  3 +-
 ...to-efi-format-nvram-json.x86_64-latest.err |  2 +-
 ...manual-efi-qemuvars-q35.x86_64-latest.args | 34 +++++++++++++++++++
 ...-manual-efi-qemuvars-q35.x86_64-latest.err |  1 -
 ...-manual-efi-qemuvars-q35.x86_64-latest.xml |  2 +-
 tests/qemuxmlconftest.c                       |  2 +-
 6 files changed, 39 insertions(+), 5 deletions(-)
 create mode 100644 
tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.args
 delete mode 100644 
tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.err

diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index ce90f95d0a..e45081eadb 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -2145,7 +2145,8 @@ qemuFirmwareFillDomain(virQEMUDriver *driver,
         loader->nvram &&
         loader->nvram->format &&
         loader->nvram->format != VIR_STORAGE_FILE_RAW &&
-        loader->nvram->format != VIR_STORAGE_FILE_QCOW2) {
+        loader->nvram->format != VIR_STORAGE_FILE_QCOW2 &&
+        loader->nvram->format != VIR_STORAGE_FILE_JSON) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Unsupported nvram format '%1$s'"),
                        
virStorageFileFormatTypeToString(loader->nvram->format));
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
index e5f67f8d09..3edb2b3451 100644
--- 
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
@@ -1 +1 @@
-unsupported configuration: Unsupported nvram format 'json'
+operation failed: Unable to find 'efi' firmware that is compatible with the 
current configuration
diff --git 
a/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.args 
b/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.args
new file mode 100644
index 0000000000..ffc3d3c86d
--- /dev/null
+++ b/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.args
@@ -0,0 +1,34 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-guest \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \
+/usr/bin/qemu-system-x86_64 \
+-name guest=guest,debug-threads=on \
+-S \
+-object 
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}'
 \
+-machine pc-q35-10.0,usb=off,dump-guest-core=off,memory-backend=pc.ram,acpi=on 
\
+-accel tcg \
+-cpu qemu64 \
+-bios /usr/share/edk2/ovmf/OVMF.qemuvars.fd \
+-m size=1048576k \
+-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}' \
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-audiodev '{"id":"audio1","driver":"none"}' \
+-global ICH9-LPC.noreboot=off \
+-watchdog-action reset \
+-sandbox 
on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git 
a/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.err 
b/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.err
deleted file mode 100644
index e5f67f8d09..0000000000
--- a/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.err
+++ /dev/null
@@ -1 +0,0 @@
-unsupported configuration: Unsupported nvram format 'json'
diff --git 
a/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.xml 
b/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.xml
index a16c404eaf..16cdac6c51 100644
--- a/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-q35.x86_64-latest.xml
@@ -6,7 +6,7 @@
   <vcpu placement='static'>1</vcpu>
   <os>
     <type arch='x86_64' machine='pc-q35-10.0'>hvm</type>
-    <loader type='rom'>/usr/share/edk2/ovmf/OVMF.qemuvars.fd</loader>
+    <loader type='rom' 
format='raw'>/usr/share/edk2/ovmf/OVMF.qemuvars.fd</loader>
     <nvram format='json'>/path/to/guest.json</nvram>
     <boot dev='hd'/>
   </os>
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 4934afd02d..886e676d9e 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -1560,7 +1560,7 @@ mymain(void)
                                   ARG_CAPS_VARIANT, "+inteltdx",
                                   ARG_END);
 
-    DO_TEST_CAPS_LATEST_FAILURE("firmware-manual-efi-qemuvars-q35");
+    DO_TEST_CAPS_LATEST("firmware-manual-efi-qemuvars-q35");
     
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("firmware-manual-efi-qemuvars-aarch64", 
"aarch64");
     
DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-manual-efi-qemuvars-nvram-network-nbd");
 
-- 
2.52.0

Reply via email to