Antoni Segura Puimedon has uploaded a new change for review.

Change subject: Generalize asynchronous ifupping of network interfaces.
......................................................................

Generalize asynchronous ifupping of network interfaces.

Make the already used asynchronous ifupping of network
interfaces (added for BZ#498940) to be an option of the
general ifup function.

Change-Id: If305a9730222deb76aa3c52f0239e3a833a952bd
Signed-off-by: Antoni S. Puimedon <[email protected]>
---
M vdsm/configNetwork.py
1 file changed, 15 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/97/8097/1

diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 9fa5930..b9a924c 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -60,10 +60,20 @@
     return rc
 
 
-def ifup(iface):
+def ifup(iface, async = False):
     "Bring up an interface"
-    rc, out, err = execCmd([constants.EXT_IFUP, iface], raw=True)
-    return rc
+    _ifup = lambda netIf: execCmd([constants.EXT_IFUP, netIf], raw=True)
+
+    if async:
+        # wait for dhcp in another thread,
+        # so vdsm won't get stuck (BZ#498940)
+        t = threading.Thread(target=_ifup, name='ifup-waiting-on-dhcp',
+                             args=(iface,))
+        t.daemon = True
+        t.start()
+    else:
+        rc, out, err = _ifup(iface)
+        return rc
 
 
 def ifaceUsers(iface):
@@ -958,20 +968,11 @@
         ifup(iface)
 
     if bridged:
-        if bridgeBootproto == 'dhcp' and \
-           not utils.tobool(options.get('blockingdhcp')):
-            # wait for dhcp in another thread,
-            # so vdsm won't get stuck (BZ#498940)
-            t = threading.Thread(target=ifup, name='ifup-waiting-on-dhcp',
-                                 args=(network,))
-            t.daemon = True
-            t.start()
-        else:
-            ifup(network)
+        ifup(network, bridgeBootproto == 'dhcp' and \
+                      not utils.tobool(options.get('blockingdhcp')))
 
     # add libvirt network
     configWriter.createLibvirtNetwork(network, bridged, iface)
-
 
 def assertBridgeClean(bridge, vlan, bonding, nics):
     brifs = os.listdir('/sys/class/net/%s/brif/' % bridge)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If305a9730222deb76aa3c52f0239e3a833a952bd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to