From: Ian Jackson Subject: [PATCH] pvscsi xend python syntax problem Date: Mon, 20 Oct 2008 14:35:42 +0100 Message-ID: <18684.35118.284372.851545@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="lHsTlUZO4j" 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 Cc: Jun Kamada , Tomonari Horikoshi List-Id: xen-devel@lists.xenproject.org --lHsTlUZO4j Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit xen-unstable changeset 17959:6ae87b27cc contains a syntax error in vscsi_get_scsidevices: File "/local/scratch/xenrt/xenrtbuildH17919/build/dist/install/usr/lib/python/xen/util/vscsi_util.py", line 126, in vscsi_get_scsidevices UnboundLocalError: local variable 'sg' referenced before assignment This is because the loop tries to add the device, including information about its sg, without first setting sg. I've grepped the code and setting sg to None seems the safest bet. Ian. Signed-off-by: Ian Jackson --lHsTlUZO4j Content-Type: text/plain Content-Description: do not use sg before it is set Content-Disposition: inline; filename="xend-pvscsi-sg-undefined.diff" Content-Transfer-Encoding: 7bit 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:34:31 2008 +0100 @@ -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]) --lHsTlUZO4j 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 --lHsTlUZO4j--