Skip to contentSkip to conversation

Fix xm scsi-attach for host OS without lsscsi

PATCH New Masaki Kanno 1 participant 1 message Mar 13, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix xm scsi-attach for host OS without lsscsi

Hi,

In the case of a host OS without lsscsi command, xm scsi-attach command fails even if you specify existing SCSI device.

# cat /proc/scsi/scsi 
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: FUJITSU  Model: E2000            Rev: 0000
  Type:   Direct-Access                    ANSI SCSI revision: 05
<<snip>>
# xm scsi-attach vm1 0:0:0:0 0:0:0:0
Error: Cannot find device '0:0:0:0'
Usage: xm scsi-attach <Domain> <PhysDevice> <VirtDevice> [BackDomain]

Attach a new SCSI device.

This patch solves the problem.
Sorry, the problem is caused by my patch (changeset: 19221).

Best regards,
Kan

tools/python/xen/util/vscsi_util.py +3 -1
diff -r a4274d1e85a3 tools/python/xen/util/vscsi_util.py
@@ -152,7 +152,9 @@ def vscsi_get_hctl_and_devname_by(target
         elif target.startswith('/dev/'): 
             scsi_devices = _vscsi_get_scsidevices_by_lsscsi("| grep %s" % target)
         else:
-            scsi_devices = vscsi_get_scsidevices()
+            scsi_devices = _vscsi_get_scsidevices_by_lsscsi("")
+        if not scsi_devices:
+            scsi_devices = _vscsi_get_scsidevices_by_sysfs()
 
     if len(target.split(':')) == 4:
         return _vscsi_get_devname_by(target, scsi_devices)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel