Change in vdsm[master]: factor out hook logic in setupNetworks

ibarkan at redhat.com ibarkan at redhat.com
Thu Nov 27 16:39:33 UTC 2014


Ido Barkan has uploaded a new change for review.

Change subject: factor out hook logic in setupNetworks
......................................................................

factor out hook logic in setupNetworks

Change-Id: Iad0808bc2fc6260636390af925ca754ed6c51de1
Signed-off-by: ibarkan <ibarkan at redhat.com>
---
M vdsm/network/api.py
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/93/35693/1

diff --git a/vdsm/network/api.py b/vdsm/network/api.py
index 8f36b31..b5aec19 100755
--- a/vdsm/network/api.py
+++ b/vdsm/network/api.py
@@ -649,6 +649,17 @@
                                      'connectivity check failed')
 
 
+def _apply_hook(bondings, networks, options):
+    results = hooks.before_network_setup(_buildSetupHookDict(networks,
+                                                             bondings,
+                                                             options))
+    # gather any changes that could have been done by the hook scripts
+    networks = results['request']['networks']
+    bondings = results['request']['bondings']
+    options = results['request']['options']
+    return bondings, networks, options
+
+
 def setupNetworks(networks, bondings, **options):
     """Add/Edit/Remove configuration for networks and bondings.
 
@@ -701,14 +712,7 @@
         logging.debug("Validating configuration")
         _validateNetworkSetup(networks, bondings)
 
-    results = hooks.before_network_setup(_buildSetupHookDict(networks,
-                                                             bondings,
-                                                             options))
-
-    # gather any changes that could have been done by the hook scripts
-    networks = results['request']['networks']
-    bondings = results['request']['bondings']
-    options = results['request']['options']
+    bondings, networks, options = _apply_hook(bondings, networks, options)
 
     libvirt_nets = netinfo.networks()
     _netinfo = netinfo.NetInfo(_netinfo=netinfo.get(


-- 
To view, visit http://gerrit.ovirt.org/35693
To unsubscribe, visit http://gerrit.ovirt.org/settings

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