JSON format NVRAM files are accessed through the uefi-vars QEMU
device, and at least currently that only supports local files, so
we need to forbid the use for remote locations for the format.

The firmware-manual-efi-qemuvars-nvram-network-nbd test case
starts failing earlier and with a different error message after
this change. This is expected and desirable.

Signed-off-by: Andrea Bolognani <[email protected]>
---
 src/qemu/qemu_validate.c                      |  5 +++
 ...muvars-nvram-network-nbd.x86_64-latest.err |  2 +-
 ...muvars-nvram-network-nbd.x86_64-latest.xml | 40 -------------------
 tests/qemuxmlconftest.c                       |  2 +-
 4 files changed, 7 insertions(+), 42 deletions(-)
 delete mode 100644 
tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-nvram-network-nbd.x86_64-latest.xml

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 40676bef39..5ecf34f622 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -734,6 +734,11 @@ qemuValidateDomainDefNvram(const virDomainDef *def,
                            _("The uefi-vars device is not supported by this 
QEMU binary"));
             return -1;
         }
+        if (!virStorageSourceIsLocalStorage(src)) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("Remote JSON files are not supported with 
NVRAM"));
+            return -1;
+        }
     }
 
     if (src->sliceStorage) {
diff --git 
a/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-nvram-network-nbd.x86_64-latest.err
 
b/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-nvram-network-nbd.x86_64-latest.err
index e5f67f8d09..424b06199a 100644
--- 
a/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-nvram-network-nbd.x86_64-latest.err
+++ 
b/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-nvram-network-nbd.x86_64-latest.err
@@ -1 +1 @@
-unsupported configuration: Unsupported nvram format 'json'
+unsupported configuration: Remote JSON files are not supported with NVRAM
diff --git 
a/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-nvram-network-nbd.x86_64-latest.xml
 
b/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-nvram-network-nbd.x86_64-latest.xml
deleted file mode 100644
index 14f2800174..0000000000
--- 
a/tests/qemuxmlconfdata/firmware-manual-efi-qemuvars-nvram-network-nbd.x86_64-latest.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<domain type='qemu'>
-  <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>
-    <type arch='x86_64' machine='pc-q35-10.0'>hvm</type>
-    <loader type='rom'>/usr/share/edk2/ovmf/OVMF.qemuvars.fd</loader>
-    <nvram type='network' format='json'>
-      <source protocol='nbd' name='bar'>
-        <host name='example.org' port='6000'/>
-      </source>
-    </nvram>
-    <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/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index 500cbbd45b..4934afd02d 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -1562,7 +1562,7 @@ mymain(void)
 
     DO_TEST_CAPS_LATEST_FAILURE("firmware-manual-efi-qemuvars-q35");
     
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("firmware-manual-efi-qemuvars-aarch64", 
"aarch64");
-    
DO_TEST_CAPS_LATEST_FAILURE("firmware-manual-efi-qemuvars-nvram-network-nbd");
+    
DO_TEST_CAPS_LATEST_PARSE_ERROR("firmware-manual-efi-qemuvars-nvram-network-nbd");
 
     /* Make sure all combinations of ACPI and UEFI behave as expected */
     DO_TEST_CAPS_ARCH_LATEST("firmware-manual-efi-acpi-aarch64", "aarch64");
-- 
2.52.0

Reply via email to