Change in vdsm[master]: net: get network switch type from libvirt

phoracek at redhat.com phoracek at redhat.com
Fri Apr 29 11:35:24 UTC 2016


Petr Horáček has uploaded a new change for review.

Change subject: net: get network switch type from libvirt
......................................................................

net: get network switch type from libvirt

Until now we reported switch type as 'legacy'. Now we get actual
switch type from libvirt network XML definition.

Change-Id: Ie733d39efa0fd40a81d3111d55fa19dde9a3c1b6
Bug-Url: https://bugzilla.redhat.com/1195208
Signed-off-by: Petr Horáček <phoracek at redhat.com>
---
M lib/vdsm/netinfo/__init__.py
M lib/vdsm/netinfo/cache.py
2 files changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/56838/1

diff --git a/lib/vdsm/netinfo/__init__.py b/lib/vdsm/netinfo/__init__.py
index 941113a..132b267 100644
--- a/lib/vdsm/netinfo/__init__.py
+++ b/lib/vdsm/netinfo/__init__.py
@@ -23,6 +23,9 @@
 
 import xml.etree.cElementTree as etree
 
+from vdsm.network.legacy_switch import SWITCH_TYPE as LEGACY_SWITCH_TYPE
+from vdsm.network.ovs.switch import SWITCH_TYPE as OVS_SWITCH_TYPE
+
 from ..ipwrapper import DUMMY_BRIDGE
 from .. import libvirtconnection
 
@@ -57,4 +60,10 @@
             else:
                 nets[netname]['bridge'] = xml.find('.//bridge').get('name')
                 nets[netname]['bridged'] = True
+            virtualport = xml.find('.//virtualport')
+            if (virtualport is not None and
+                    virtualport.get('type') == 'openvswitch'):
+                nets[netname]['switch'] = OVS_SWITCH_TYPE
+            else:
+                nets[netname]['switch'] = LEGACY_SWITCH_TYPE
     return nets
diff --git a/lib/vdsm/netinfo/cache.py b/lib/vdsm/netinfo/cache.py
index cd69ce3..849ff52 100644
--- a/lib/vdsm/netinfo/cache.py
+++ b/lib/vdsm/netinfo/cache.py
@@ -94,7 +94,6 @@
             network_info['cfg'] = networking['bridges'][network_name]['cfg']
         updates = propose_updates_to_reported_dhcp(network_info, networking)
         update_reported_dhcp(updates, networking)
-        networking['networks'][network_name].update(LEGACY_SWITCH)
 
     report_network_qos(networking)
     networking['supportsIPv6'] = ipv6_supported()


-- 
To view, visit https://gerrit.ovirt.org/56838
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie733d39efa0fd40a81d3111d55fa19dde9a3c1b6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>


More information about the vdsm-patches mailing list