]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: simplify check for vlan tagging support in virDomainActualNetDefValidate()
authorLaine Stump <laine@redhat.com>
Thu, 15 Jan 2026 00:28:17 +0000 (19:28 -0500)
committerLaine Stump <laine@redhat.com>
Fri, 16 Jan 2026 17:32:37 +0000 (12:32 -0500)
Since the only two types of bridges we support are OVS bridges and
Linux host bridges, and since both of those now support vlan tagging,
we don't need to check the virtualport type etc - if there is a bridge
specified then we know the interface will support vlan tagging.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/domain_validate.c

index 4589965923470e9f131663e3c59c3276ac467985..44822030874c4911cd80aca6de3ed51116583b75 100644 (file)
@@ -2229,15 +2229,12 @@ virDomainActualNetDefValidate(const virDomainNetDef *net)
     if (virDomainNetGetActualVlan(net)) {
         /* vlan configuration via libvirt is only supported for PCI
          * Passthrough SR-IOV devices (hostdev or macvtap passthru
-         * mode) and openvswitch bridges. Otherwise log an error and
-         * fail
+         * mode) and openvswitch/linux host bridges.
          */
-        if (!(actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV ||
+        if (!(virDomainNetGetActualBridgeName(net) ||
+              actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV ||
               (actualType == VIR_DOMAIN_NET_TYPE_DIRECT &&
-               virDomainNetGetActualDirectMode(net) == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) ||
-              (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE &&
-               vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) ||
-              (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE && !vport))) {
+               virDomainNetGetActualDirectMode(net) == VIR_NETDEV_MACVLAN_MODE_PASSTHRU))) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("interface %1$s - vlan tag not supported for this connection type"),
                            macstr);