From: "KUWAMURA Shin'ya" Subject: [PATCH] [RFC] xend: use popen2 module instead of subprocess for Python 2.3 Date: Fri, 29 May 2009 14:42:09 +0900 (JST) Message-ID: <20090529.144209.00025487.kuwa@jp.fujitsu.com> Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Fri_May_29_14_42_09_2009_818)--" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org ----Next_Part(Fri_May_29_14_42_09_2009_818)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, On Python 2.3, xend cannot started: File "usr/lib/python2.3/site-packages/xen/xend/server/BlktapController.py", line 3, in ? import subprocess ImportError: No module named subprocess This patch uses `popen2' instead of `subprocess' for Python 2.3. However, I tested only 'xend start'. Is this correct? And, is Python 2.3 still supported? Signed-off-by: KUWAMURA Shin'ya -- KUWAMURA Shin'ya ----Next_Part(Fri_May_29_14_42_09_2009_818)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix-blktap2-python-2.3.patch" # HG changeset patch # User KUWAMURA Shin'ya # Date 1243574978 -32400 # Node ID 006107c3d953ab8e5803e793db9cb7ef99487c15 # Parent 9e72be06ac4be008f2e673ce11ef86c346e34faa xend: use popen2 module instead of subprocess for Python 2.3 The module `subprocess' was introduced in Python 2.4. This patch uses `popen2' instead of `subprocess' for Python 2.3. Signed-off-by: KUWAMURA Shin'ya diff -r 9e72be06ac4b -r 006107c3d953 tools/python/xen/xend/server/BlktapController.py --- a/tools/python/xen/xend/server/BlktapController.py Fri May 29 14:22:30 2009 +0900 +++ b/tools/python/xen/xend/server/BlktapController.py Fri May 29 14:29:38 2009 +0900 @@ -1,6 +1,6 @@ # Copyright (c) 2005, XenSource Ltd. import string, re -import subprocess +import popen2 from xen.xend.server.blkif import BlkifController from xen.xend.XendLogging import log @@ -27,9 +27,12 @@ blktap_disk_types = [ def doexec(args, inputtext=None): """Execute a subprocess, then return its return code, stdout and stderr""" - proc = subprocess.Popen(args,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,close_fds=True) - (stdout,stderr) = proc.communicate(inputtext) - rc = proc.returncode + proc = popen2.Popen3(args, True) + if inputtext != None: + proc.tochild.write(inputtext) + stdout = proc.fromchild + stderr = proc.childerr + rc = proc.poll() return (rc,stdout,stderr) def parseDeviceString(device): ----Next_Part(Fri_May_29_14_42_09_2009_818)-- Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ----Next_Part(Fri_May_29_14_42_09_2009_818)----