Edward Haas has uploaded a new change for review.

Change subject: net: Split bond setup handler for future validation
......................................................................

net: Split bond setup handler for future validation

There is a need to add a validation check after networks & bonds
removal step.
This patch drops the single setup method.

The following patch will introduce the validation.

Change-Id: Idbb346d2231285148b84329b8fa83b4db45285c2
Signed-off-by: Edward Haas <edwa...@redhat.com>
---
M lib/vdsm/network/netswitch.py
1 file changed, 11 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/64241/1

diff --git a/lib/vdsm/network/netswitch.py b/lib/vdsm/network/netswitch.py
index 787c687..fbe74d0 100644
--- a/lib/vdsm/network/netswitch.py
+++ b/lib/vdsm/network/netswitch.py
@@ -157,11 +157,11 @@
 
 def _setup_ovs(networks, bondings, options, in_rollback):
     _ovs_info = ovs_info.OvsInfo()
-    ovs_netinfo = ovs_info.create_netinfo(_ovs_info)
+    ovs_nets = ovs_info.create_netinfo(_ovs_info)['networks']
     _netinfo = netinfo()
 
     nets2add, nets2edit, nets2remove = _split_setup_actions(
-        networks, ovs_netinfo['networks'])
+        networks, ovs_nets)
     bonds2add, bonds2edit, bonds2remove = _split_setup_actions(
         bondings, _netinfo['bondings'])
 
@@ -172,9 +172,16 @@
 
     # FIXME: we are not able to move a nic from bond to network in one setup
     with Transaction(in_rollback=in_rollback) as config:
-        with ifacquire.Transaction(ovs_netinfo['networks']) as acq:
+        setup_bonds = SetupBonds(bonds2add, bonds2edit, bonds2remove, config)
+        with ifacquire.Transaction(ovs_nets) as acq:
             _remove_networks(nets2remove, _ovs_info, config)
-            _setup_bonds(bonds2add, bonds2edit, bonds2remove, config, acq)
+
+            setup_bonds.remove_bonds()
+
+            acq.acquire(setup_bonds.ifaces_for_acquirement)
+            setup_bonds.edit_bonds()
+            setup_bonds.add_bonds()
+
             _add_networks(nets2add, _ovs_info, config, acq)
 
             setup_ipv6autoconf(networks)
@@ -189,14 +196,6 @@
     net_rem_setup.remove(nets2remove)
     for net, attrs in six.iteritems(nets2remove):
         config.removeNetwork(net)
-
-
-def _setup_bonds(bonds2add, bonds2edit, bonds2remove, config, acq):
-    setup_bonds = SetupBonds(bonds2add, bonds2edit, bonds2remove, config)
-    setup_bonds.remove_bonds()
-    acq.acquire(setup_bonds.ifaces_for_acquirement)
-    setup_bonds.edit_bonds()
-    setup_bonds.add_bonds()
 
 
 def _add_networks(nets2add, ovs_info, config, acq):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idbb346d2231285148b84329b8fa83b4db45285c2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwa...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to