[PATCH 2/4] qemu: use actual/effective vlan when updating OVS-based interface vlan tag

Laine Stump via Devel posted 4 patches 2 weeks, 3 days ago
[PATCH 2/4] qemu: use actual/effective vlan when updating OVS-based interface vlan tag
Posted by Laine Stump via Devel 2 weeks, 3 days ago
From: Laine Stump <laine@redhat.com>

Using &newdev->vlan when updating the vlan tag causes problems if the
interface is using a libvirt virtual network to get its vlan tag
info - in this case the info won't be properly pulled from the virtual network
config, but instead it will just use the (empty)
vlan object from the netdef.

The proper thing to do is to use virDomainNetGetActualVlan(), which
will pull the vlan tag from the network definition, if applicable.

Signed-off-by: Laine Stunp <laine@redhat.com>
Signed-off-by: Laine Stump <laine@redhat.com>
---
 src/qemu/qemu_hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 6d20e3a850..c5905dba23 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4263,7 +4263,7 @@ qemuDomainChangeNet(virQEMUDriver *driver,
              * will redo vlan setup without needing to re-attach the
              * tap device to the bridge
              */
-            if (virNetDevOpenvswitchUpdateVlan(newdev->ifname, &newdev->vlan) < 0)
+            if (virNetDevOpenvswitchUpdateVlan(newdev->ifname, virDomainNetGetActualVlan(newdev)) < 0)
                 goto cleanup;
         } else if (newType == VIR_DOMAIN_NET_TYPE_DIRECT &&
                    virDomainNetGetActualDirectMode(newdev) == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) {
-- 
2.52.0
Re: [PATCH 2/4] qemu: use actual/effective vlan when updating OVS-based interface vlan tag
Posted by Ján Tomko via Devel 2 weeks, 2 days ago
On a Thursday in 2026, Laine Stump via Devel wrote:
>From: Laine Stump <laine@redhat.com>
>
>Using &newdev->vlan when updating the vlan tag causes problems if the
>interface is using a libvirt virtual network to get its vlan tag
>info - in this case the info won't be properly pulled from the virtual network
>config, but instead it will just use the (empty)
>vlan object from the netdef.
>
>The proper thing to do is to use virDomainNetGetActualVlan(), which
>will pull the vlan tag from the network definition, if applicable.
>
>Signed-off-by: Laine Stunp <laine@redhat.com>
>Signed-off-by: Laine Stump <laine@redhat.com>

How did you manage to sign off twice? Usually `git commit -s` avoids
this.

Jano

>---
> src/qemu/qemu_hotplug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Re: [PATCH 2/4] qemu: use actual/effective vlan when updating OVS-based interface vlan tag
Posted by Laine Stump via Devel 2 weeks, 2 days ago
On 1/16/26 11:16 AM, Ján Tomko via Devel wrote:
> On a Thursday in 2026, Laine Stump via Devel wrote:
>> From: Laine Stump <laine@redhat.com>
>>
>> Using &newdev->vlan when updating the vlan tag causes problems if the
>> interface is using a libvirt virtual network to get its vlan tag
>> info - in this case the info won't be properly pulled from the virtual 
>> network
>> config, but instead it will just use the (empty)
>> vlan object from the netdef.
>>
>> The proper thing to do is to use virDomainNetGetActualVlan(), which
>> will pull the vlan tag from the network definition, if applicable.
>>
>> Signed-off-by: Laine Stunp <laine@redhat.com>
>> Signed-off-by: Laine Stump <laine@redhat.com>
> 
> How did you manage to sign off twice? Usually `git commit -s` avoids
> this.

That's odd - the duplicate isn't there in my local directory, and I 
certainly would have noticed an existing SOB on the adjancent line if I 
manually added it in.