Change in vdsm[master]: net api: Normalize the network bridged flag

edwardh at redhat.com edwardh at redhat.com
Wed Jan 20 10:14:23 UTC 2016


Edward Haas has uploaded a new change for review.

Change subject: net api: Normalize the network bridged flag
......................................................................

net api: Normalize the network bridged flag

Normalize the network bridged flag at the network api entry point.

Change-Id: I09a58b356718f4239e081afcd1bf690ae5756a5b
Signed-off-by: Edward Haas <edwardh at redhat.com>
---
M lib/vdsm/network/api.py
1 file changed, 9 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/52482/1

diff --git a/lib/vdsm/network/api.py b/lib/vdsm/network/api.py
index 43e2da6..14a9982 100755
--- a/lib/vdsm/network/api.py
+++ b/lib/vdsm/network/api.py
@@ -254,7 +254,6 @@
     nics = nics or ()
     if _netinfo is None:
         _netinfo = CachingNetInfo()
-    bridged = utils.tobool(bridged)
     if dhcpv6 is not None:
         dhcpv6 = utils.tobool(dhcpv6)
     if ipv6autoconf is not None:
@@ -748,7 +747,7 @@
         vlan_name = '%s.%s' % (topNetDev.name, networkAttrs['vlan'])
         if vlan_name in _netinfo.vlans:
             topNetDev = Vlan(topNetDev, networkAttrs['vlan'], configurator)
-    if networkAttrs.get('bridged', True):
+    if networkAttrs['bridged']:
         if network in _netinfo.bridges:
             topNetDev = Bridge(network, configurator, port=topNetDev)
 
@@ -827,7 +826,7 @@
     if marked_for_removal:
         return False
 
-    should_be_bridged = network_attrs.get('bridged')
+    should_be_bridged = network_attrs['bridged']
     if currently_bridged and not should_be_bridged:
         return False
 
@@ -971,6 +970,7 @@
 
         normalize.norm_mtu()
         normalize.norm_vlan()
+        normalize.norm_bridged()
 
 
 class _Normalize(object):
@@ -996,6 +996,12 @@
         else:
             data['vlan'] = int(vlan)
 
+    def norm_bridged(self):
+        if 'bridged' in self.data:
+            self.data['bridged'] = utils.tobool(self.data['bridged'])
+        else:
+            self.data['bridged'] = True
+
 
 def setSafeNetworkConfig():
     """Declare current network configuration as 'safe'"""


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I09a58b356718f4239e081afcd1bf690ae5756a5b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwardh at redhat.com>


More information about the vdsm-patches mailing list