Francesco Romani has uploaded a new change for review.
Change subject: network: switch to concurrent.thread()
......................................................................
network: switch to concurrent.thread()
This patch:
1. replaces good usages of threading.Thread() with
more modern concurrent.thread()
2. replaces bad usages of threading.Thread() - inheritance
with composition, leveraging concurrent.thread()
there are no intended changes in behaviour.
Change-Id: Ie7918a6762b35000b02187a0356273e40bba57a8
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M lib/vdsm/network/configurators/ifcfg.py
M lib/vdsm/network/ip/dhclient.py
2 files changed, 7 insertions(+), 8 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/59/61459/1
diff --git a/lib/vdsm/network/configurators/ifcfg.py
b/lib/vdsm/network/configurators/ifcfg.py
index e9f67e1..9168e05 100644
--- a/lib/vdsm/network/configurators/ifcfg.py
+++ b/lib/vdsm/network/configurators/ifcfg.py
@@ -29,7 +29,6 @@
import re
import selinux
import shutil
-import threading
import uuid
import six
@@ -39,6 +38,7 @@
from vdsm.config import config
from vdsm import commands
from vdsm import cmdutils
+from vdsm import concurrent
from vdsm import constants
from vdsm import dsaversion
from vdsm import hooks
@@ -846,9 +846,9 @@
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, cgroup))
- t.daemon = True
+ t = concurrent.thread(_exec_ifup,
+ name='ifup-waiting-on-dhcp',
+ args=(iface, cgroup))
t.start()
else:
if not iface.master and (iface.ipv4 or iface.ipv6):
diff --git a/lib/vdsm/network/ip/dhclient.py b/lib/vdsm/network/ip/dhclient.py
index 318217c..f67a876 100644
--- a/lib/vdsm/network/ip/dhclient.py
+++ b/lib/vdsm/network/ip/dhclient.py
@@ -24,9 +24,9 @@
import logging
import os
import subprocess
-import threading
from vdsm import cmdutils
+from vdsm import concurrent
from vdsm.network import errors as ne
from vdsm.network import netinfo
from vdsm.commands import execCmd
@@ -73,9 +73,8 @@
if blocking:
return self._dhclient()
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):
--
To view, visit
https://gerrit.ovirt.org/61459
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie7918a6762b35000b02187a0356273e40bba57a8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>