[PATCH 4/4] conf: simplify check for vlan tagging support in virDomainActualNetDefValidate()

Laine Stump via Devel posted 4 patches 2 weeks, 3 days ago
[PATCH 4/4] conf: simplify check for vlan tagging support in virDomainActualNetDefValidate()
Posted by Laine Stump via Devel 2 weeks, 3 days ago
From: Laine Stump <laine@redhat.com>

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>
---
 src/conf/domain_validate.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 4589965923..4482203087 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -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);
-- 
2.52.0