Change in vdsm[master]: Move _stpBooleanize to netinfo.

ibarkan at redhat.com ibarkan at redhat.com
Thu Jun 4 19:57:03 UTC 2015


Ido Barkan has uploaded a new change for review.

Change subject: Move _stpBooleanize to netinfo.
......................................................................

Move _stpBooleanize to netinfo.

And rename it. It will be used in the following patched from
netconfpersistence.py

Change-Id: Ie1b2dc96fb405c2055431209023f1cb5130e5ae5
Signed-off-by: Ido Barkan <ibarkan at redhat.com>
---
M lib/vdsm/netinfo.py
M vdsm/network/api.py
2 files changed, 14 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/41972/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 8f2c68b..91f7581 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -215,6 +215,19 @@
         return 'off'
 
 
+def stpBooleanize(value):
+    if value is None:
+        return False
+    if type(value) is bool:
+        return value
+    if value.lower() in ('true', 'on', 'yes'):
+        return True
+    elif value.lower() in ('false', 'off', 'no'):
+        return False
+    else:
+        raise ValueError('Invalid value for bridge stp')
+
+
 def isvirtio(dev):
     return 'virtio' in os.readlink('/sys/class/net/%s/device' % dev)
 
diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 6071f8d..bafbf1a 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -153,7 +153,7 @@
         elif 'STP' in opts:
             stp = opts.pop('STP')
         try:
-            stp = _stpBooleanize(stp)
+            stp = netinfo.stpBooleanize(stp)
         except ValueError:
             raise ConfigNetworkError(ne.ERR_BAD_PARAMS, '"%s" is not a valid '
                                      'bridge STP value.' % stp)
@@ -168,19 +168,6 @@
     topNetDev.blockingdhcp = (configurator._inRollback or
                               utils.tobool(blockingdhcp))
     return topNetDev
-
-
-def _stpBooleanize(value):
-    if value is None:
-        return False
-    if type(value) is bool:
-        return value
-    if value.lower() in ('true', 'on', 'yes'):
-        return True
-    elif value.lower() in ('false', 'off', 'no'):
-        return False
-    else:
-        raise ValueError('Invalid value for bridge stp')
 
 
 def _validateInterNetworkCompatibility(ni, vlan, iface):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1b2dc96fb405c2055431209023f1cb5130e5ae5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan at redhat.com>


More information about the vdsm-patches mailing list