[virt-tools-list] [virt-manager PATCH] Added OpenVSwitch Network Detection

Charles d'Hondt charles.dhondt at gmail.com
Thu Mar 23 15:06:56 UTC 2017


Small patch to allow VMM to detect OpenVSwitch 

Signed-off-by: Charles d'Hondt <charles.dhondt at gmail.com>
---
 virtManager/netlist.py | 6 +++++-
 virtinst/network.py    | 4 +++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/virtManager/netlist.py b/virtManager/netlist.py
index bdadbf3..aae87b4 100644
--- a/virtManager/netlist.py
+++ b/virtManager/netlist.py
@@ -146,6 +146,9 @@ class vmmNetworkList(vmmGObjectUI):
             if not net.is_active():
                 label += " (%s)" % _("Inactive")
 
+            if net.get_xmlobj().virtualport_type == "openvswitch":
+                label += " (%s)" % "OpenVSwitch"
+
             if net.get_name() == "default":
                 default_label = label
 
@@ -526,8 +529,9 @@ class vmmNetworkList(vmmGObjectUI):
         if not row:
             return
 
+        is_openvswitch = (row[2][-12:-1] == "OpenVSwitch")
         is_direct = (row[0] == virtinst.VirtualNetworkInterface.TYPE_DIRECT)
-        self.widget("vport-expander").set_visible(is_direct)
+        self.widget("vport-expander").set_visible(is_direct or is_openvswitch)
         uiutil.set_grid_row_visible(self.widget("net-source-mode"), is_direct)
         uiutil.set_grid_row_visible(
             self.widget("net-macvtap-warn-box"), is_direct)
diff --git a/virtinst/network.py b/virtinst/network.py
index 80c03d4..28d257b 100644
--- a/virtinst/network.py
+++ b/virtinst/network.py
@@ -212,7 +212,7 @@ class Network(XMLBuilder):
     ##################
 
     _XML_ROOT_NAME = "network"
-    _XML_PROP_ORDER = ["ipv6", "name", "uuid", "forward",
+    _XML_PROP_ORDER = ["ipv6", "name", "uuid", "forward", "virtualport_type"
                        "bridge", "stp", "delay", "domain_name",
                        "macaddr", "ips", "routes", "bandwidth"]
 
@@ -222,6 +222,8 @@ class Network(XMLBuilder):
                        validate_cb=lambda s, v: util.validate_uuid(v),
                        default_cb=_get_default_uuid)
 
+    virtualport_type = XMLProperty("./virtualport/@type")
+
     # Not entirely correct, there can be multiple routes
     forward = XMLChildProperty(_NetworkForward, is_single=True)
 
-- 
2.1.4




More information about the virt-tools-list mailing list