[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xend: Fix scsi_id for pvSCSI



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1238495230 -3600
# Node ID 2d19139c1c9c74a271262f990db6e5a0f3499508
# Parent  1522573509309fdc5ba9348b04622af6de676205
xend: Fix scsi_id for pvSCSI

pvSCSI allocations fail if the version of udev in a host OS is
relatively new.  I have not been able to detect the failure because
I have used udev of the version 095.  The failure occurs by
an incompatibility problem of scsi_id command included udev.
This patch tackles the incompatibility problem.

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/util/vscsi_util.py |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff -r 152257350930 -r 2d19139c1c9c tools/python/xen/util/vscsi_util.py
--- a/tools/python/xen/util/vscsi_util.py       Tue Mar 31 11:26:10 2009 +0100
+++ b/tools/python/xen/util/vscsi_util.py       Tue Mar 31 11:27:10 2009 +0100
@@ -35,6 +35,11 @@ SYSFS_SCSI_DEV_TYPEID_PATH = '/type'
 SYSFS_SCSI_DEV_TYPEID_PATH = '/type'
 SYSFS_SCSI_DEV_REVISION_PATH = '/rev'
 SYSFS_SCSI_DEV_SCSILEVEL_PATH = '/scsi_level'
+
+SCSI_ID_COMMANDS = [
+    "/lib/udev/scsi_id -gu --sg-version 3 -d /dev/%s 2>/dev/null",
+    "/sbin/scsi_id -gu -s /class/scsi_generic/%s 2>/dev/null"
+]
 
 def _vscsi_get_devname_by(name, scsi_devices):
     """A device name is gotten by the HCTL.
@@ -79,9 +84,10 @@ def _vscsi_get_hctl_by(phyname, scsi_dev
 
 
 def _vscsi_get_scsiid(sg):
-    scsi_id = os.popen('/sbin/scsi_id -gu -s /class/scsi_generic/' + 
sg).read().split()
-    if len(scsi_id):
-        return scsi_id[0]
+    for scsi_id_command in SCSI_ID_COMMANDS:
+        scsi_id = os.popen(scsi_id_command % sg).read().split()
+        if len(scsi_id):
+            return scsi_id[0]
     return None
 
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.