From: Laine Stump <[email protected]>

When support for vhostuser devices was added, it was just
blanket-prevented from making any changes to a live device with
update-device. This is problematic because the link state of a network
device is modified with update-device. Most all of the parameters of a
vhostuser network device are individually checked within
qemuDomainChangeNet() anyway, so we don't need to just do a BRS (Big
Red Switch) forbidding of any change. We do need to check for
modifications to the socket parameters (path, type, reconnect) though,
since those are vhostuser-specific (we're not already checking for
them elsewhere) and they can't be changed on a live interface.

Resolves https://redhat.atlassian.net/browse/RHEL-152533
Resolves: https://bugs.passt.top/show_bug.cgi?id=198
Signed-off-by: Laine Stump <[email protected]>
---
 src/qemu/qemu_hotplug.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7ab28bed6d..e33ef5e1e9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4129,6 +4129,24 @@ qemuDomainChangeNet(virQEMUDriver *driver,
             break;
 
         case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
+            /* the path the to vhostuser socket and its parameters
+             * can't be changed.  In the case of a PASST backend using
+             * vhostuser, all of those parameters are internally
+             * generated anyway, so the user wouldn't be able to
+             * specify them in the updated XML.
+             */
+            if (newdev->backend.type != VIR_DOMAIN_NET_BACKEND_PASST &&
+                (STRNEQ_NULLABLE(olddev->data.vhostuser->data.nix.path, 
newdev->data.vhostuser->data.nix.path) ||
+                 olddev->data.vhostuser->data.nix.listen != 
newdev->data.vhostuser->data.nix.listen ||
+                 olddev->data.vhostuser->data.nix.reconnect.enabled != 
newdev->data.vhostuser->data.nix.reconnect.enabled ||
+                 olddev->data.vhostuser->data.nix.reconnect.timeout != 
newdev->data.vhostuser->data.nix.reconnect.timeout)) {
+                virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+                               _("unable to change socket config on '%1$s' 
network type"),
+                               virDomainNetTypeToString(newdev->type));
+                goto cleanup;
+            }
+            break;
+
         case VIR_DOMAIN_NET_TYPE_HOSTDEV:
         case VIR_DOMAIN_NET_TYPE_VDPA:
         case VIR_DOMAIN_NET_TYPE_NULL:
-- 
2.53.0

Reply via email to