Yaniv Bronhaim has uploaded a new change for review. Change subject: draft patch - removing all deathsignal usages where calls are async only to verify work with subprocess32 ......................................................................
draft patch - removing all deathsignal usages where calls are async only to verify work with subprocess32 We need to return same object as popen and remove asyncProc - same for all usages in watchcmd. Change-Id: I2a181393923d81c863d7e9e8bde4b75a20fb56de Signed-off-by: Yaniv Bronhaim <ybron...@redhat.com> --- M lib/vdsm/commands.py M lib/vdsm/compat.py M lib/vdsm/v2v.py M vdsm/storage/imageSharing.py 4 files changed, 7 insertions(+), 19 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/60209/1 diff --git a/lib/vdsm/commands.py b/lib/vdsm/commands.py index bffec83..b71ff18 100644 --- a/lib/vdsm/commands.py +++ b/lib/vdsm/commands.py @@ -43,14 +43,9 @@ def execCmd(command, sudo=False, cwd=None, data=None, raw=False, printable=None, env=None, sync=True, nice=None, ioclass=None, ioclassdata=None, setsid=False, execCmdLogger=logging.root, - deathSignal=0, resetCpuAffinity=True): + resetCpuAffinity=True): """ Executes an external command, optionally via sudo. - - IMPORTANT NOTE: the new process would receive `deathSignal` when the - controlling thread dies, which may not be what you intended: if you create - a temporary thread, spawn a sync=False sub-process, and have the thread - finish, the new subprocess would die immediately. """ command = cmdutils.wrap_command(command, with_ioclass=ioclass, @@ -67,8 +62,7 @@ execCmdLogger.debug(cmdutils.command_log_line(printable, cwd=cwd)) - p = CPopen(command, close_fds=True, cwd=cwd, env=env, - deathSignal=deathSignal) + p = CPopen(command, close_fds=True, cwd=cwd, env=env) if not sync: p = AsyncProc(p) if data is not None: @@ -337,13 +331,12 @@ def watchCmd(command, stop, cwd=None, data=None, nice=None, ioclass=None, - execCmdLogger=logging.root, deathSignal=signal.SIGKILL): + execCmdLogger=logging.root): """ Executes an external command, optionally via sudo with stop abilities. """ proc = execCmd(command, cwd=cwd, data=data, sync=False, - nice=nice, ioclass=ioclass, execCmdLogger=execCmdLogger, - deathSignal=deathSignal) + nice=nice, ioclass=ioclass, execCmdLogger=execCmdLogger) if not proc.wait(cond=stop): proc.kill() diff --git a/lib/vdsm/compat.py b/lib/vdsm/compat.py index 8884005..562e554 100644 --- a/lib/vdsm/compat.py +++ b/lib/vdsm/compat.py @@ -41,7 +41,7 @@ import sys if sys.version_info[0] == 2: - from cpopen import CPopen + from subprocess32 import Popen as CPopen CPopen # make pyflakes happy else: from subprocess import Popen as CPopen diff --git a/lib/vdsm/v2v.py b/lib/vdsm/v2v.py index defbe14..890a9c5 100644 --- a/lib/vdsm/v2v.py +++ b/lib/vdsm/v2v.py @@ -32,7 +32,6 @@ import logging import os import re -import signal import tarfile import threading import xml.etree.ElementTree as ET @@ -391,7 +390,6 @@ def _start_helper(self): return execCmd(self._command(), sync=False, - deathSignal=signal.SIGTERM, nice=NICENESS.HIGH, ioclass=IOCLASS.IDLE, env=self._environment()) diff --git a/vdsm/storage/imageSharing.py b/vdsm/storage/imageSharing.py index b8c3240..6081e9e 100644 --- a/vdsm/storage/imageSharing.py +++ b/vdsm/storage/imageSharing.py @@ -18,7 +18,6 @@ # import logging -import signal from vdsm import commands from vdsm import constants @@ -77,8 +76,7 @@ totalSize = getLengthFromArgs(methodArgs) fileObj = methodArgs['fileObj'] cmd = [constants.EXT_DD, "of=%s" % dstImgPath, "bs=%s" % constants.MEGAB] - p = commands.execCmd(cmd, sudo=False, sync=False, - deathSignal=signal.SIGKILL) + p = commands.execCmd(cmd, sudo=False, sync=False) try: _copyData(fileObj, p.stdin, totalSize) p.stdin.close() @@ -103,8 +101,7 @@ cmd = [constants.EXT_DD, "if=%s" % dstImgPath, "bs=%s" % constants.MEGAB, "count=%s" % (total_size / constants.MEGAB + 1)] - p = commands.execCmd(cmd, sync=False, - deathSignal=signal.SIGKILL) + p = commands.execCmd(cmd, sync=False) p.blocking = True try: _copyData(p.stdout, fileObj, bytes_left) -- To view, visit https://gerrit.ovirt.org/60209 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2a181393923d81c863d7e9e8bde4b75a20fb56de Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim <ybron...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/vdsm-patches@lists.fedorahosted.org