Hi Sean, On Thu, 2013-02-28 at 12:19 -0500, Sean Liu wrote: > Hi there, > > > I am trying to make MHVTL (https://sites.google.com/site/linuxvtl2/) work > under LIO. > > MHVTL emulates virtual tape libraries and currently it can integrate with > stgt framework. > > Here's what has been emulated on my test machine (Ubuntu 12.04LTS): > > root@vUbuntu:~# lsscsi -g > > [1:0:0:0] cd/dvd NECVMWar VMware IDE CDR10 1.00 /dev/sr0 /dev/sg0 > > [2:0:0:0] disk VMware, VMware Virtual S 1.0 /dev/sda /dev/sg1 > > [3:0:0:0] mediumx STK L700 0104 /dev/sch0 /dev/sg10 > > [3:0:1:0] tape IBM ULT3580-TD5 0104 /dev/st0 /dev/sg2 > > [3:0:2:0] tape IBM ULT3580-TD5 0104 /dev/st1 /dev/sg3 > > [3:0:3:0] tape IBM ULT3580-TD4 0104 /dev/st2 /dev/sg4 > > [3:0:4:0] tape IBM ULT3580-TD4 0104 /dev/st3 /dev/sg5 > > [3:0:8:0] mediumx STK L80 0104 /dev/sch1 /dev/sg11 > > [3:0:9:0] tape STK T10000B 0104 /dev/st4 /dev/sg6 > > [3:0:10:0] tape STK T10000B 0104 /dev/st5 /dev/sg7 > > [3:0:11:0] tape STK T10000B 0104 /dev/st6 /dev/sg8 > > [3:0:12:0] tape STK T10000B 0104 /dev/st7 /dev/sg9 > > > > With targetcli, I would imagine I'll have to use pscsi (iblock seems to only > work with disk devices) to export the tape lib and drives. However when I > try to add the backstores, I got following errors: > > /backstores/pscsi> create name=tapelib1 dev=/dev/sg2 > > Cannot find SCSI device by path, and dev parameter not in H:C:T:L format: > /dev/sg2. > > /backstores/pscsi> create name=tapelib1 dev=3:0:0:0 > > SCSI device does not exist. > > > > As a matter of fact, even the disk could not be added: > > /backstores/pscsi> create name=disk1 dev=/dev/sg1 > > Cannot find SCSI device by path, and dev parameter not in H:C:T:L format: > /dev/sg1. > Note that the pscsi dev= parameter in targetcli assumes a block device (/dev/sdX or /dev/sr), so this currently does not work with SCSI medium changers or tapes that use character devices.. > > > Am I missing anything? Or is pscsi not supported at all? > One work-around is to use tcm_node (from lio-utils.git) w/ a quick patch inline below to address changes in modern target_core_pscsi.ko code. So with lsscsi output of mhvtl looking like: [12:0:0:0] mediumx STK L700 0104 /dev/sch0 [12:0:1:0] tape IBM ULT3580-TD5 0104 /dev/st0 [12:0:2:0] tape IBM ULT3580-TD5 0104 /dev/st3 [12:0:3:0] tape IBM ULT3580-TD4 0104 /dev/st1 [12:0:4:0] tape IBM ULT3580-TD4 0104 /dev/st2 [12:0:8:0] mediumx STK L80 0104 /dev/sch1 [12:0:9:0] tape STK T10000B 0104 /dev/st5 [12:0:10:0] tape STK T10000B 0104 /dev/st6 [12:0:11:0] tape STK T10000B 0104 /dev/st7 [12:0:12:0] tape STK T10000B 0104 /dev/st4 use tcm_node --scsi= with the following syntax. Note that H:C:T:L needs to line up with pscsi_XX/foo X:X:X: # tcm_node --scsi=pscsi_12/sch0 0:1:0 dev_path: pscsi_12/sch0 Status: DEACTIVATED Execute/Left/Max Queue Depth: 0/32/32 SectorSize: 0 MaxSectors: 1024 SCSI Device Bus Location: Channel ID: 0 Target ID: 1 LUN: 0 Host ID: PHBA Mode Vendor: IBM Model: ULT3580-TD5 Rev: 0104 # tcm_node --scsi=pscsi_12/st0 0:2:0 dev_path: pscsi_12/st0 Status: DEACTIVATED Execute/Left/Max Queue Depth: 0/32/32 SectorSize: 0 MaxSectors: 1024 SCSI Device Bus Location: Channel ID: 0 Target ID: 2 LUN: 0 Host ID: PHBA Mode Vendor: IBM Model: ULT3580-TD5 Rev: 0104 that will then show up under /backstores/pscsi/ and can be used normally in targetcli like other backstores: /> ls /backstores/pscsi/ o- pscsi ................................................... [2 Storage Objects] o- sch0 ......................... [LEGACY: SHARED HBA (/dev/null deactivated)] o- st0 ............................ [LEGACY: SHARED HBA (/dev/null activated)] The patch to tcm_pscsi.py is below. Note this currently does not support saving configuration state across restart with tcm_dump.py, which will need to be addressed separately. However, it should be enough to get an initial configuration up and running. Please let us know if you run into any other issues. --nab diff --git a/tcm-py/tcm_pscsi.py b/tcm-py/tcm_pscsi.py index defe508..74d8c14 100755 --- a/tcm-py/tcm_pscsi.py +++ b/tcm-py/tcm_pscsi.py @@ -50,6 +50,8 @@ def createvirtdev(path, params): pscsi_params = params[0] # print pscsi_params + udev_path = "/dev/null" + # Exract HCTL from sysfs and set udev_path if re.search('/dev/', pscsi_params): udev_path = pscsi_params.rstrip() @@ -102,14 +104,13 @@ def createvirtdev(path, params): scsi_lun_id = scsi_hctl[3] print "pSCSI: Referencing HCTL " + out[1].rstrip() + " for udev_path: " + udev_path - set_udev_path_op = "echo -n " + udev_path + " > " + cfs_path + "udev_path" - ret = os.system(set_udev_path_op) - if ret: - print "pSCSI: Unable to set udev_path in " + cfs_path + " for: " + udev_path - return -1 - pscsi_params = "scsi_host_id=" + scsi_host_id + ",scsi_channel_id=" + scsi_channel_id + ",scsi_targe - + + set_udev_path_op = "echo -n " + udev_path + " > " + cfs_path + "udev_path" + ret = os.system(set_udev_path_op) + if ret: + print "pSCSI: Unable to set udev_path in " + cfs_path + " for: " + udev_path + return -1 control_opt = "echo -n " + pscsi_params + " > " + cfs_path + "control" # print "Calling control_opt " + control_opt -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html