Change in vdsm[master]: Moving cpopen import to compat to allow working with python 3
Yaniv Bronhaim has abandoned this change. Change subject: Moving cpopen import to compat to allow working with python 3 .. Abandoned we're go with https://gerrit.ovirt.org/55379 -- To view, visit https://gerrit.ovirt.org/48384 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I181cd2e52706bfe7b24073d0f0eb42fec15ac490 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: Moving cpopen import to compat to allow working with python 3
gerrit-hooks has posted comments on this change. Change subject: Moving cpopen import to compat to allow working with python 3 .. Patch Set 2: * Update tracker: IGNORE, no Bug-Url found -- To view, visit https://gerrit.ovirt.org/48384 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I181cd2e52706bfe7b24073d0f0eb42fec15ac490 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: Moving cpopen import to compat to allow working with python 3
Nir Soffer has posted comments on this change. Change subject: Moving cpopen import to compat to allow working with python 3 .. Patch Set 2: Code-Review-1 (1 comment) https://gerrit.ovirt.org/#/c/48384/2/lib/vdsm/qemuimg.py File lib/vdsm/qemuimg.py: Line 222: Line 223: cmd = cmdutils.wrap_command(cmd, with_nice=utils.NICENESS.HIGH, Line 224: with_ioclass=utils.IOCLASS.IDLE) Line 225: _log.debug(cmdutils.command_log_line(cmd, cwd=cwd)) Line 226: self._command = Popen(cmd, cwd=cwd, deathSignal=signal.SIGKILL) We should first remove deathSignal, and add stdin=PIPE, stdout=PIPE, stderr=PIPE, because subprocess.Popen default is None, while CPopen default is PIPE. Line 227: self._stream = utils.CommandStream( Line 228: self._command, self._recvstdout, self._recvstderr) Line 229: Line 230: def _recvstderr(self, buffer): -- To view, visit https://gerrit.ovirt.org/48384 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I181cd2e52706bfe7b24073d0f0eb42fec15ac490 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: Moving cpopen import to compat to allow working with python 3
Yaniv Bronhaim has posted comments on this change. Change subject: Moving cpopen import to compat to allow working with python 3 .. Patch Set 2: Verified+1 -- To view, visit https://gerrit.ovirt.org/48384 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I181cd2e52706bfe7b24073d0f0eb42fec15ac490 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: Moving cpopen import to compat to allow working with python 3
gerrit-hooks has posted comments on this change. Change subject: Moving cpopen import to compat to allow working with python 3 .. Patch Set 2: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/48384 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I181cd2e52706bfe7b24073d0f0eb42fec15ac490 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: Moving cpopen import to compat to allow working with python 3
Nir Soffer has posted comments on this change. Change subject: Moving cpopen import to compat to allow working with python 3 .. Patch Set 1: Code-Review-1 (1 comment) Nice, but we are not ready for this yet. https://gerrit.ovirt.org/#/c/48384/1/lib/vdsm/qemuimg.py File lib/vdsm/qemuimg.py: Line 222: Line 223: cmd = cmdutils.wrap_command(cmd, with_nice=utils.NICENESS.HIGH, Line 224: with_ioclass=utils.IOCLASS.IDLE) Line 225: _log.debug(cmdutils.command_log_line(cmd, cwd=cwd)) Line 226: self._command = Popen(cmd, cwd=cwd, deathSignal=signal.SIGKILL) cpopen.CPopen defaults are different than subprocess.Popen, so this usage is incorrect - you don't get a pipe for stdin, stdout and stderr, and the progress code will fail. We must add stdin=PIPE, stdout=PIPE, stderr=PIPE to all Popen calls to keep the current semantics. We may have other stuff which is not compatible, like close_fds. Also this can be done only after removing CPopen options which are not supported by subprocess.Popen - deathSignal, childUmas and probably other. Line 227: self._stream = utils.CommandStream( Line 228: self._command, self._recvstdout, self._recvstderr) Line 229: Line 230: def _recvstderr(self, buffer): -- To view, visit https://gerrit.ovirt.org/48384 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I181cd2e52706bfe7b24073d0f0eb42fec15ac490 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: Moving cpopen import to compat to allow working with python 3
automat...@ovirt.org has posted comments on this change. Change subject: Moving cpopen import to compat to allow working with python 3 .. Patch Set 1: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/48384 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I181cd2e52706bfe7b24073d0f0eb42fec15ac490 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: Moving cpopen import to compat to allow working with python 3
Yaniv Bronhaim has uploaded a new change for review. Change subject: Moving cpopen import to compat to allow working with python 3 .. Moving cpopen import to compat to allow working with python 3 Once python3-copen will be available we'll be able to use it. Till then this import trick will allow us to work with the python Popen Change-Id: I181cd2e52706bfe7b24073d0f0eb42fec15ac490 Signed-off-by: Yaniv Bronhaim --- M lib/vdsm/compat.py M lib/vdsm/infra/zombiereaper/tests.py M lib/vdsm/qemuimg.py M lib/vdsm/utils.py M vdsm/storage/remoteFileHandler.py 5 files changed, 13 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/84/48384/1 diff --git a/lib/vdsm/compat.py b/lib/vdsm/compat.py index 8ac5201..5c785a9 100644 --- a/lib/vdsm/compat.py +++ b/lib/vdsm/compat.py @@ -38,3 +38,8 @@ # no big deal, fallback to standard libary import json json # yep, this is needed twice. + +try: +from cpopen import CPopen as Popen +except ImportError: +from subprocess import Popen diff --git a/lib/vdsm/infra/zombiereaper/tests.py b/lib/vdsm/infra/zombiereaper/tests.py index 681579f..9392758 100644 --- a/lib/vdsm/infra/zombiereaper/tests.py +++ b/lib/vdsm/infra/zombiereaper/tests.py @@ -22,7 +22,7 @@ import os from .. import zombiereaper -from cpopen import CPopen +from vdsm.compat import Popen from unittest import TestCase @@ -36,7 +36,7 @@ zombiereaper.unregisterSignalHandler() def testProcessDiesAfterBeingTracked(self): -p = CPopen(["sleep", "1"]) +p = Popen(["sleep", "1"]) zombiereaper.autoReapPID(p.pid) # wait for the grim reaper to arrive sleep(4) @@ -45,7 +45,7 @@ self.assertRaises(OSError, os.waitpid, p.pid, os.WNOHANG) def testProcessDiedBeforeBeingTracked(self): -p = CPopen(["sleep", "0"]) +p = Popen(["sleep", "0"]) # wait for the process to die sleep(1) diff --git a/lib/vdsm/qemuimg.py b/lib/vdsm/qemuimg.py index bce9973..49ea43d 100644 --- a/lib/vdsm/qemuimg.py +++ b/lib/vdsm/qemuimg.py @@ -24,7 +24,7 @@ import re import signal -from cpopen import CPopen +from vdsm.compat import Popen from . import utils from . import cmdutils @@ -223,7 +223,7 @@ cmd = cmdutils.wrap_command(cmd, with_nice=utils.NICENESS.HIGH, with_ioclass=utils.IOCLASS.IDLE) _log.debug(cmdutils.command_log_line(cmd, cwd=cwd)) -self._command = CPopen(cmd, cwd=cwd, deathSignal=signal.SIGKILL) +self._command = Popen(cmd, cwd=cwd, deathSignal=signal.SIGKILL) self._stream = utils.CommandStream( self._command, self._recvstdout, self._recvstderr) diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py index 9ebef54..0b14e59 100644 --- a/lib/vdsm/utils.py +++ b/lib/vdsm/utils.py @@ -52,6 +52,7 @@ import string import threading import time +from vdsm.compat import Popen import vdsm.infra.zombiereaper as zombiereaper from cpopen import CPopen @@ -629,7 +630,6 @@ 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, ioclassdata=ioclassdata, with_nice=nice, with_setsid=setsid, with_sudo=sudo, diff --git a/vdsm/storage/remoteFileHandler.py b/vdsm/storage/remoteFileHandler.py index e69ae8c..2123777 100644 --- a/vdsm/storage/remoteFileHandler.py +++ b/vdsm/storage/remoteFileHandler.py @@ -33,7 +33,7 @@ if __name__ != "__main__": # The following modules are not used by the newly spawned child porcess. # Do not import them in the child to save memory. -from cpopen import CPopen +from vdsm.compat import Popen from vdsm import constants else: # We add the parent directory so that imports that import the storage @@ -231,7 +231,7 @@ env.get("PYTHONPATH", ""), constants.P_VDSM) env['PYTHONPATH'] = ":".join(map(os.path.abspath, env['PYTHONPATH'].split(":"))) -self.process = CPopen([constants.EXT_PYTHON, __file__, +self.process = Popen([constants.EXT_PYTHON, __file__, str(hisRead), str(hisWrite)], close_fds=False, env=env) -- To view, visit https://gerrit.ovirt.org/48384 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I181cd2e52706bfe7b24073d0f0eb42fec15ac490 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Yaniv Bronhaim ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches