]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: do all vhostuser attribute validation in qemu driver
authorLaine Stump <laine@redhat.com>
Mon, 10 Feb 2025 00:01:32 +0000 (19:01 -0500)
committerLaine Stump <laine@redhat.com>
Mon, 17 Feb 2025 04:58:35 +0000 (23:58 -0500)
Since vhostuser is only used/supported by the QEMU driver, and all the
rest of the vhostuser-specific validation is done in QEMU's
validation, lets move the final check (to see if they've tried to
enable auto-reconnect when this interface is on the server side of the
vhostuser socket) to the QEMU validate.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_validate.c
src/qemu/qemu_validate.c

index d0e2bcaccf58806fafefe2f4fd6439495ea024f1..577dbab0af7a73c296b5783eb2041d7b630b6111 100644 (file)
@@ -2185,15 +2185,6 @@ virDomainNetDefValidate(const virDomainNetDef *net)
     }
 
     switch (net->type) {
-    case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
-        if (net->data.vhostuser->data.nix.listen &&
-            net->data.vhostuser->data.nix.reconnect.enabled == VIR_TRISTATE_BOOL_YES) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("'reconnect' attribute unsupported 'server' mode for <interface type='vhostuser'>"));
-            return -1;
-        }
-        break;
-
     case VIR_DOMAIN_NET_TYPE_USER:
         if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
             size_t p;
@@ -2217,6 +2208,7 @@ virDomainNetDefValidate(const virDomainNetDef *net)
         }
         break;
 
+    case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
     case VIR_DOMAIN_NET_TYPE_NETWORK:
     case VIR_DOMAIN_NET_TYPE_VDPA:
     case VIR_DOMAIN_NET_TYPE_BRIDGE:
index 243c499a337fdfa7ce4bc8a53d3c04330c5d3757..351fe388309572003f7a838910406fa34f4d4419 100644 (file)
@@ -1825,6 +1825,14 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
         }
     }
 
+    if (net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
+        net->data.vhostuser->data.nix.listen &&
+        net->data.vhostuser->data.nix.reconnect.enabled == VIR_TRISTATE_BOOL_YES) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("'reconnect' attribute is not supported when source mode='server' for <interface type='vhostuser'>"));
+        return -1;
+    }
+
     if (!virDomainNetIsVirtioModel(net)) {
         if (net->type == VIR_DOMAIN_NET_TYPE_VDPA ||
             net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {