[PATCH 1/4] qemu: interface: add qemuDomainDefIsOvsport

zhangjl02 jx8zjs at 126.com
Mon Jun 28 09:18:20 UTC 2021


From: zhangjl02 <zhangjl02 at inspur.com>

Tell whether a port definition is an ovs managed virtual port
---
 src/qemu/qemu_domain.c | 13 +++++++++++++
 src/qemu/qemu_domain.h |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index fc60e15eea..da5a226fc2 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11575,3 +11575,16 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfig *cfg,
 
     return 0;
 }
+
+/*
+ * Check whether the port is an ovs managed port
+ */
+bool qemuDomainDefIsOvsport(virDomainNetDef *net,
+                         int actualType) {
+    const virNetDevVPortProfile *vport = virDomainNetGetActualVirtPortProfile(net);
+    if ((actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) && vport  &&
+        vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
+        return true;
+    }
+    return false;
+}
\ No newline at end of file
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index acf6ca5ab6..81a9bf0cfb 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -1063,3 +1063,6 @@ int
 qemuDomainNamePathsCleanup(virQEMUDriverConfig *cfg,
                            const char *name,
                            bool bestEffort);
+
+bool qemuDomainDefIsOvsport(virDomainNetDef *net,
+        int actualType);
\ No newline at end of file
-- 
2.30.2.windows.1




More information about the libvir-list mailing list