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

Change subject: net: canonicalize switch type from custom options
......................................................................

net: canonicalize switch type from custom options

If network/bond is marked as OVS one via custom option, mark it with
OVS switch type via 'switch' attribute too.

This might be used for testing of native OVS until OVS UI changes take
place in Engine.

Change-Id: Id2451a7fbd19e33f6d2dcd9fcc93adbf6e06ab24
Bug-Url: https://bugzilla.redhat.com/??????
Signed-off-by: Petr Horáček <[email protected]>
---
M lib/vdsm/network/canonicalize.py
1 file changed, 15 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/65/55865/1

diff --git a/lib/vdsm/network/canonicalize.py b/lib/vdsm/network/canonicalize.py
index 55dd2b3..2d3d047 100644
--- a/lib/vdsm/network/canonicalize.py
+++ b/lib/vdsm/network/canonicalize.py
@@ -21,7 +21,7 @@
 
 import six
 
-from vdsm.netinfo import (bridges, mtus)
+from vdsm.netinfo import (bridges, mtus, bonding)
 from vdsm import utils
 
 from .errors import ConfigNetworkError
@@ -44,7 +44,7 @@
         _canonicalize_bridged(attrs)
         _canonicalize_stp(attrs)
         _canonicalize_ipv6(attrs)
-        _canonicalize_switch_type(attrs)
+        _canonicalize_switch_type_net(attrs)
 
 
 def canonicalize_bondings(bonds):
@@ -58,7 +58,7 @@
         if _canonicalize_remove(attrs):
             continue
 
-        _canonicalize_switch_type(attrs)
+        _canonicalize_switch_type_bond(attrs)
 
 
 def _canonicalize_remove(data):
@@ -106,6 +106,17 @@
         data['dhcpv6'] = False
 
 
-def _canonicalize_switch_type(data):
+def _canonicalize_switch_type_net(data):
+    if utils.tobool(utils.rget(data, ('custom', 'ovs'))):
+        data['switch'] = 'ovs'
+    if 'switch' not in data:
+        data['switch'] = 'legacy'
+
+
+def _canonicalize_switch_type_bond(data):
+    options = data.get('options', '')
+    ovs = utils.rget(bonding.parse_bond_options(options), ('custom', 'ovs'))
+    if utils.tobool(ovs):
+        data['switch'] = 'ovs'
     if 'switch' not in data:
         data['switch'] = 'legacy'


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id2451a7fbd19e33f6d2dcd9fcc93adbf6e06ab24
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to