From: Laine Stump Date: Wed, 14 Jan 2026 01:16:50 +0000 (-0500) Subject: qemu: update vlan tag of macvtap (direct) passthrough devices during update-device X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5a406a768b08a732e6c95ada054e1350098a161;p=thirdparty%2Flibvirt.git qemu: update vlan tag of macvtap (direct) passthrough devices during update-device We already update the vlan tag of interfaces that are attached to an OVS bridge or Linux host bridge. This patch adds the bit of code necessary to update the vlan tag of a macvtap passthrough interface (the only other type of interface that supports vlan tagging). Resolves: https://issues.redhat.com/browse/RHEL-74487 Resolves: https://issues.redhat.com/browse/RHEL-7300 Signed-off-by: Laine Stump Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index cfc586e17d..78d9d18218 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -4274,11 +4274,21 @@ qemuDomainChangeNet(virQEMUDriver *driver, */ if (virNetDevOpenvswitchUpdateVlan(newdev->ifname, &newdev->vlan) < 0) goto cleanup; - } else { + } else if (newType == VIR_DOMAIN_NET_TYPE_DIRECT && + virDomainNetGetActualDirectMode(newdev) == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) { + if (virNetDevSetNetConfig(virDomainNetGetActualDirectDev(newdev), + -1, NULL, virDomainNetGetActualVlan(newdev), NULL, true) < 0) { + goto cleanup; + } + } else if (newBridgeName) { /* vlan setup is done as a part of reconnecting the tap * device to a new bridge (either OVS or Linux host bridge). */ needBridgeChange = true; + } else { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("unable to change vlan on '%1$s' network type"), + virDomainNetTypeToString(newType)); } needReplaceDevDef = true; }