]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: update vlan tag of macvtap (direct) passthrough devices during update-device
authorLaine Stump <laine@redhat.com>
Wed, 14 Jan 2026 01:16:50 +0000 (20:16 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 16 Jan 2026 17:32:36 +0000 (12:32 -0500)
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 <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_hotplug.c

index cfc586e17d072330b1d1a86aba8597e0c9659e28..78d9d18218ff4c9e2be38d39ccfdf8891ad9313c 100644 (file)
@@ -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;
     }