From: Ian Jackson Subject: Re: [PATCH] pvscsi xend python syntax problem Date: Mon, 20 Oct 2008 14:46:34 +0100 Message-ID: <18684.35770.189941.747513@mariner.uk.xensource.com> References: <18684.35118.284372.851545@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <18684.35118.284372.851545@mariner.uk.xensource.com> 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, Jun Kamada , Tomonari Horikoshi List-Id: xen-devel@lists.xenproject.org Also, I've just noticed this: if re.match('^scsi_generic', f): os.chdir(os.path.join(paths, f)) sg = os.path.basename(os.getcwd()) which is really crazy! A utility function like this must not just use chdir! Is this really the best way of doing this ? In the meantime this might be a better patch. (NB: not tested.) Ian. diff -r 4129f0f2f2ba tools/python/xen/util/vscsi_util.py --- a/tools/python/xen/util/vscsi_util.py Fri Oct 17 14:15:37 2008 +0100 +++ b/tools/python/xen/util/vscsi_util.py Mon Oct 20 14:46:11 2008 +0100 @@ -114,7 +114,7 @@ def vscsi_get_scsidevices(): os.chdir(os.path.join(paths, f)) block = os.path.basename(os.getcwd()) - if re.match('^scsi_generic', f): + if false and re.match('^scsi_generic', f): os.chdir(os.path.join(paths, f)) sg = os.path.basename(os.getcwd()) lines = os.popen('/sbin/scsi_id -gu -s /class/scsi_generic/' + sg).read().split() @@ -122,6 +122,8 @@ def vscsi_get_scsidevices(): scsi_id = '-' else: scsi_id = lines[0] + else: + sg = None devices.append([hctl, block, sg, scsi_id])