[PATCH 2/3] qemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces

Peter Krempa posted 3 patches 1 day, 4 hours ago
[PATCH 2/3] qemuValidateDomainDeviceDefNetwork: Require shared memory for all vhost-user interfaces
Posted by Peter Krempa 1 day, 4 hours ago
Currently we produce only a warning into the log if a non-passt
vhost-user interface is configured with shared memory.

Since we do make it fatal with all other vhost-user types, fix the check
to trigger also for normal-vhost-user interfaces.

Since passt-based vhost-user interfaces are checked separately the check
will no longer be required.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_validate.c                                 | 9 +++------
 .../net-vhostuser-passt-no-shmem.x86_64-latest.err       | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 4ab7af36f3..4282d8c11d 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1843,12 +1843,6 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
         return -1;
     }

-    if (net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
-        net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
-        if (qemuValidateDomainDefVhostUserRequireSharedMemory(def, "interface type=\"vhostuser\" backend type=\"passt\"") < 0)
-            return -1;
-    }
-
     if (net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
         if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_VHOST_VDPA)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -1872,6 +1866,9 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
                            _("'reconnect' attribute is not supported when source mode='server' for <interface type='vhostuser'>"));
             return -1;
         }
+
+        if (qemuValidateDomainDefVhostUserRequireSharedMemory(def, "interface") < 0)
+            return -1;
     }

     if (!virDomainNetIsVirtioModel(net)) {
diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err b/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err
index 274af5c722..babde17518 100644
--- a/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err
+++ b/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err
@@ -1 +1 @@
-unsupported configuration: 'interface type="vhostuser" backend type="passt"' requires shared memory
+unsupported configuration: 'interface' requires shared memory
-- 
2.48.1