[PATCHv2 1/4] virDomain: interface: add virDomainNetDefIsOvsport

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: zhangjl02 <zhangjl02@xxxxxxxxxx>

Tell whether a port definition is an ovs managed virtual port
---
 src/conf/domain_conf.c   | 8 ++++++++
 src/conf/domain_conf.h   | 2 ++
 src/libvirt_private.syms | 1 +
 3 files changed, 11 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d78f846a52..7fe72fb3f2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29126,6 +29126,14 @@ virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface)
     }
 }
 
+/* Check whether the port is an ovs managed port */
+bool
+virDomainNetDefIsOvsport(virDomainNetDef *net, int actualType) {
+    const virNetDevVPortProfile *vport = virDomainNetGetActualVirtPortProfile(net);
+    return (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) && vport  &&
+        vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH;
+}
+
 const virNetDevBandwidth *
 virDomainNetGetActualBandwidth(const virDomainNetDef *iface)
 {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index f706c498ff..a024e4394f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3608,6 +3608,8 @@ int virDomainNetGetActualDirectMode(const virDomainNetDef *iface);
 virDomainHostdevDef *virDomainNetGetActualHostdev(virDomainNetDef *iface);
 const virNetDevVPortProfile *
 virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface);
+bool
+virDomainNetDefIsOvsport(virDomainNetDef *net, int actualType);
 const virNetDevBandwidth *
 virDomainNetGetActualBandwidth(const virDomainNetDef *iface);
 const virNetDevVlan *virDomainNetGetActualVlan(const virDomainNetDef *iface);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 68e4b6aab8..2bcbce7288 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -517,6 +517,7 @@ virDomainNetDefActualFromNetworkPort;
 virDomainNetDefActualToNetworkPort;
 virDomainNetDefFormat;
 virDomainNetDefFree;
+virDomainNetDefIsOvsport;
 virDomainNetDefNew;
 virDomainNetDefToNetworkPort;
 virDomainNetDHCPInterfaces;
-- 
2.30.2.windows.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux