[PATCH 0/2] qemu: allow changing link state on vhostuser interfaces
(and a 2nd incidental patch to log an error and fail if someone tries to change the <backend type>) Laine Stump (2): qemu: log error on attempts to change backend type of live network interface qemu: allow update-device of vhostuser network devices src/qemu/qemu_hotplug.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) -- 2.53.0
From: Laine Stump <laine@redhat.com> Somehow we've never checked for this, and nobody has ever tested for it or complained about it, but certainly attempting to change a user or vhostuser network device to/from a passt backend wouldn't work. Now we check for it and log an error. Signed-off-by: Laine Stump <laine@redhat.com> --- src/qemu/qemu_hotplug.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9439948089..7ab28bed6d 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3808,6 +3808,12 @@ qemuDomainChangeNet(virQEMUDriver *driver, goto cleanup; } + if (olddev->backend.type != newdev->backend.type) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("cannot change backend type of network interface")); + goto cleanup; + } + /* Check individual attributes for changes that can't be done to a * live netdev. These checks *mostly* go in order of the * declarations in virDomainNetDef in order to assure nothing is -- 2.53.0
On Mon, Apr 06, 2026 at 23:15:31 -0400, Laine Stump via Devel wrote:
From: Laine Stump <laine@redhat.com>
Somehow we've never checked for this, and nobody has ever tested for it or complained about it, but certainly attempting to change a user or vhostuser network device to/from a passt backend wouldn't work. Now we check for it and log an error.
Signed-off-by: Laine Stump <laine@redhat.com> --- src/qemu/qemu_hotplug.c | 6 ++++++ 1 file changed, 6 insertions(+)
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
From: Laine Stump <laine@redhat.com> 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 <laine@redhat.com> --- 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
On Mon, Apr 06, 2026 at 23:15:32 -0400, Laine Stump via Devel wrote:
From: Laine Stump <laine@redhat.com>
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 <laine@redhat.com> --- 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. + */
While the comment explains it, the condition is a bit unpleasant to read. I'd suggest doing: if (newdev->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) break; first with the comment stating that the passt stuff is autogenerated and then follow up ...
+ if (newdev->backend.type != VIR_DOMAIN_NET_BACKEND_PASST &&
... with the rest of this as another condition:
+ (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:
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
On 4/7/26 11:19 AM, Peter Krempa via Devel wrote:
On Mon, Apr 06, 2026 at 23:15:32 -0400, Laine Stump via Devel wrote:
From: Laine Stump <laine@redhat.com>
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 <laine@redhat.com> --- 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. + */
While the comment explains it, the condition is a bit unpleasant to read.
I'd suggest doing:
if (newdev->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) break;
Sure, I can do that.
first with the comment stating that the passt stuff is autogenerated and then follow up ...
+ if (newdev->backend.type != VIR_DOMAIN_NET_BACKEND_PASST &&
... with the rest of this as another condition:
+ (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:
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
participants (2)
-
Laine Stump -
Peter Krempa