Change in vdsm[master]: net: fake OVS networks as bridgeless

phoracek at redhat.com phoracek at redhat.com
Wed May 4 23:22:24 UTC 2016


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

Change subject: net: fake OVS networks as bridgeless
......................................................................

net: fake OVS networks as bridgeless

Change-Id: I0eac59a993c86fe067f2eb53937929dc65ca8581
Bug-Url: https://bugzilla.redhat.com/1195208
Signed-off-by: Petr Horáček <phoracek at redhat.com>
---
M lib/vdsm/network/ovs/info.py
1 file changed, 33 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/57068/1

diff --git a/lib/vdsm/network/ovs/info.py b/lib/vdsm/network/ovs/info.py
index b652c44..c7e0e1c 100644
--- a/lib/vdsm/network/ovs/info.py
+++ b/lib/vdsm/network/ovs/info.py
@@ -23,6 +23,7 @@
 from vdsm.netinfo.routes import get_routes, get_gateway
 from vdsm.netinfo.addresses import getIpAddrs, getIpInfo, is_ipv6_local_auto
 from vdsm.netinfo.dhcp import dhcp_status
+from vdsm.network.netconfpersistence import RunningConfig
 
 from . import driver
 
@@ -281,5 +282,35 @@
     return netinfo
 
 
-def get_netinfo(ovs_bridges=None):
-    return _fake_expected_devices(_get_netinfo(ovs_bridges))
+def _fake_bridgeless(netinfo):
+    running_networks = RunningConfig().networks
+
+    for net, attrs in six.iteritems(netinfo['networks']):
+        running_attrs = running_networks.get(net)
+        if running_attrs is None or running_attrs['bridged']:
+            continue
+
+        bond = running_attrs.get('bonding')
+        nic = running_attrs.get('nic')
+        tag = running_attrs.get('vlan')
+        if 'vlan'in running_attrs:
+            expected_vlan_name = '%s.%s' % (bond or nic, tag)
+            _copy_port_info(netinfo['networks'][net],
+                            netinfo['vlans'][expected_vlan_name])
+        elif 'bond' in running_attrs:
+            _copy_port_info(netinfo['networks'][net],
+                            netinfo['bondings'][bond])
+        elif 'nic' in running_attrs:
+            _copy_port_info(netinfo['networks'][net], netinfo['nics'][nic])
+
+        netinfo['bridges'].pop(net)
+        netinfo['networks'][net]['bridged'] = False
+
+    return netinfo
+
+
+def get_netinfo(ovs_bridges=None, fake_bridgeless=False):
+    netinfo = _fake_expected_devices(_get_netinfo(ovs_bridges))
+    if fake_bridgeless:
+        netinfo = _fake_bridgeless(netinfo)
+    return netinfo


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0eac59a993c86fe067f2eb53937929dc65ca8581
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