Nir Soffer has uploaded a new change for review.

Change subject: network: Use new concurrent.thread() utility
......................................................................

network: Use new concurrent.thread() utility

This patch updates the networking subsystem to use the new utility.

Behavior changes:

- dhclient.DhcpClient threads are protected from silent failures
- configurators/ifcfg._ifup threads are proected from silent
  failures.

Change-Id: I62e80bbbb9354d3173cce631ed5579532cf7cdcb
Relates-To: https://bugzilla.redhat.com/1141422
Signed-off-by: Nir Soffer <[email protected]>
---
M vdsm/network/configurators/dhclient.py
M vdsm/network/configurators/ifcfg.py
M vdsm/network/sourceroutethread.py
3 files changed, 8 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/45553/1

diff --git a/vdsm/network/configurators/dhclient.py 
b/vdsm/network/configurators/dhclient.py
index 181c302..a25ae8f 100644
--- a/vdsm/network/configurators/dhclient.py
+++ b/vdsm/network/configurators/dhclient.py
@@ -23,8 +23,8 @@
 import logging
 import os
 import signal
-import threading
 
+from vdsm import concurrent
 from vdsm import cmdutils
 from vdsm import ipwrapper
 from vdsm import netinfo
@@ -76,9 +76,8 @@
             rc, _, _ = self._dhclient()
             return rc
         else:
-            t = threading.Thread(target=self._dhclient, name='vdsm-dhclient-%s'
-                                 % self.iface)
-            t.daemon = True
+            t = concurrent.thread(self._dhclient,
+                                  name='vdsm-dhclient-%s' % self.iface)
             t.start()
 
     def shutdown(self):
diff --git a/vdsm/network/configurators/ifcfg.py 
b/vdsm/network/configurators/ifcfg.py
index e1d3e94..f676f83 100644
--- a/vdsm/network/configurators/ifcfg.py
+++ b/vdsm/network/configurators/ifcfg.py
@@ -28,11 +28,11 @@
 import re
 import selinux
 import shutil
-import threading
 
 from libvirt import libvirtError, VIR_ERR_NO_NETWORK
 
 from vdsm.config import config
+from vdsm import concurrent
 from vdsm import cmdutils
 from vdsm import constants
 from vdsm import ipwrapper
@@ -782,9 +782,8 @@
     if not iface.blockingdhcp and (iface.ipv4.bootproto == 'dhcp' or
                                    iface.ipv6.dhcpv6):
         # wait for dhcp in another thread, so vdsm won't get stuck (BZ#498940)
-        t = threading.Thread(target=_exec_ifup, name='ifup-waiting-on-dhcp',
-                             args=(iface.name, cgroup))
-        t.daemon = True
+        t = concurrent.thread(_exec_ifup, name='ifup-waiting-on-dhcp',
+                              args=(iface.name, cgroup))
         t.start()
     else:
         _exec_ifup(iface.name, cgroup)
diff --git a/vdsm/network/sourceroutethread.py 
b/vdsm/network/sourceroutethread.py
index 0a49760..042e5bd 100644
--- a/vdsm/network/sourceroutethread.py
+++ b/vdsm/network/sourceroutethread.py
@@ -19,12 +19,11 @@
 from __future__ import absolute_import
 import logging
 import os
-import threading
 
 import pyinotify
 
 from vdsm.constants import P_VDSM_RUN
-from vdsm import utils
+from vdsm import concurrent
 
 from .configurators.iproute2 import Iproute2
 from .sourceroute import DynamicSourceRoute
@@ -68,13 +67,10 @@
 
 
 def start():
-    thread = threading.Thread(target=_subscribeToInotifyLoop,
-                              name='sourceRoute')
-    thread.daemon = True
+    thread = concurrent.thread(_subscribeToInotifyLoop, name='sourceRoute')
     thread.start()
 
 
[email protected]()
 def _subscribeToInotifyLoop():
     logging.debug("sourceRouteThread.subscribeToInotifyLoop started")
 


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

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

Reply via email to