RE: Exporting MHVTL devices via pscsi?

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

 



Hi Nicholas,

Sorry for the very late reply - haven't got a chance trying this again till now.
I tried to apply the patch a few times but somehow the patch command failed so I manually patched it. Maybe some copy&paste issue.
Following is the diff I created after the manual update, which should match the patch you provided.
diff --git a/tcm_pscsi.py.backup b/tcm_pscsi.py
index defe508..7de3d8c 100755
--- a/tcm_pscsi.py.backup
+++ b/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,14 @@ 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_target_id=

+       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

However, tcm_node still fails:
root@mhvtl-lio:~# lsscsi -g
[1:0:0:0]    cd/dvd  NECVMWar VMware IDE CDR10 1.00  /dev/sr0  /dev/sg0
[2:0:0:0]    disk    VMware   Virtual disk     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
root@mhvtl-lio:~# tcm_node --scsi=pscsi_3/sch0 0:1:0
pSCSI: createvirtdev failed for enable_opt with scsi_channel_id=0,scsi_target_id=1,scsi_lun_id=0
Traceback (most recent call last):
  File "/usr/sbin/tcm_node", line 739, in <module>
    main()
  File "/usr/sbin/tcm_node", line 731, in main
    (options, args) = parser.parse_args()
  File "/usr/lib/python2.7/optparse.py", line 1399, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python2.7/optparse.py", line 1439, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python2.7/optparse.py", line 1514, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python2.7/optparse.py", line 788, in process
    self.action, self.dest, opt, value, values, parser)
  File "/usr/lib/python2.7/optparse.py", line 808, in take_action
    self.callback(self, opt, value, parser, *args, **kwargs)
  File "/usr/sbin/tcm_node", line 711, in dispatcher
    orig_callback(*value)
  File "/usr/sbin/tcm_node", line 291, in tcm_create_pscsi
    tcm_createvirtdev(dev_path, pscsi_params_str)
  File "/usr/sbin/tcm_node", line 224, in tcm_createvirtdev
    print tcm_read(full_path + "/info")
  File "/usr/sbin/tcm_node", line 27, in tcm_read
    return f.read()
IOError: [Errno 19] No such device


I enabled some print statements in tcm_pscsi.py and here's a more verbose output:
root@mhvtl-lio:/usr/share/pyshared#  tcm_node --scsi=pscsi_3/sch1 0:2:0
Calling pscsi createvirtdev: params ['scsi_channel_id=0,scsi_target_id=2,scsi_lun_id=0']
scsi_channel_id=0,scsi_target_id=2,scsi_lun_id=0
Calling set udev path op:echo -n /dev/null > /sys/kernel/config/target/core/pscsi_3/sch1/udev_path
Calling control_opt echo -n scsi_channel_id=0,scsi_target_id=2,scsi_lun_id=0 > /sys/kernel/config/target/core/pscsi_3/sch1/control
Calling enable_opt echo 1 > /sys/kernel/config/target/core/pscsi_3/sch1/enable
pSCSI: createvirtdev failed for enable_opt with scsi_channel_id=0,scsi_target_id=2,scsi_lun_id=0
Traceback (most recent call last):
  File "/usr/sbin/tcm_node", line 739, in <module>
    main()
  File "/usr/sbin/tcm_node", line 731, in main
    (options, args) = parser.parse_args()
  File "/usr/lib/python2.7/optparse.py", line 1399, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python2.7/optparse.py", line 1439, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python2.7/optparse.py", line 1514, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python2.7/optparse.py", line 788, in process
    self.action, self.dest, opt, value, values, parser)
  File "/usr/lib/python2.7/optparse.py", line 808, in take_action
    self.callback(self, opt, value, parser, *args, **kwargs)
  File "/usr/sbin/tcm_node", line 711, in dispatcher
    orig_callback(*value)
  File "/usr/sbin/tcm_node", line 291, in tcm_create_pscsi
    tcm_createvirtdev(dev_path, pscsi_params_str)
  File "/usr/sbin/tcm_node", line 224, in tcm_createvirtdev
    print tcm_read(full_path + "/info")
  File "/usr/sbin/tcm_node", line 27, in tcm_read
    return f.read()
IOError: [Errno 19] No such device

I must have missed something? Here's the tree output in configfs:
root@mhvtl-lio:/usr/share/pyshared# tree /sys/kernel/config/target/core/
/sys/kernel/config/target/core/
|-- alua
|   `-- lu_gps
|       `-- default_lu_gp
|           |-- lu_gp_id
|           `-- members
`-- pscsi_3
    |-- hba_info
    |-- hba_mode
    |-- sch0
    |   |-- alias
    |   |-- alua
    |   |   `-- default_tg_pt_gp
    |   |       |-- alua_access_state
    |   |       |-- alua_access_status
    |   |       |-- alua_access_type
    |   |       |-- alua_write_metadata
    |   |       |-- members
    |   |       |-- nonop_delay_msecs
    |   |       |-- preferred
    |   |       |-- tg_pt_gp_id
    |   |       `-- trans_delay_msecs
    |   |-- alua_lu_gp
    |   |-- attrib
    |   |   |-- block_size
    |   |   |-- emulate_dpo
    |   |   |-- emulate_fua_read
    |   |   |-- emulate_fua_write
    |   |   |-- emulate_rest_reord
    |   |   |-- emulate_tas
    |   |   |-- emulate_tpu
    |   |   |-- emulate_tpws
    |   |   |-- emulate_ua_intlck_ctrl
    |   |   |-- emulate_write_cache
    |   |   |-- enforce_pr_isids
    |   |   |-- hw_block_size
    |   |   |-- hw_max_sectors
    |   |   |-- hw_queue_depth
    |   |   |-- is_nonrot
    |   |   |-- max_sectors
    |   |   |-- max_unmap_block_desc_count
    |   |   |-- max_unmap_lba_count
    |   |   |-- optimal_sectors
    |   |   |-- queue_depth
    |   |   |-- unmap_granularity
    |   |   `-- unmap_granularity_alignment
    |   |-- control
    |   |-- enable
    |   |-- info
    |   |-- pr
    |   |   |-- res_aptpl_active
    |   |   |-- res_aptpl_metadata
    |   |   |-- res_holder
    |   |   |-- res_pr_all_tgt_pts
    |   |   |-- res_pr_generation
    |   |   |-- res_pr_holder_tg_port
    |   |   |-- res_pr_registered_i_pts
    |   |   |-- res_pr_type
    |   |   `-- res_type
    |   |-- statistics
    |   |   |-- scsi_dev
    |   |   |   |-- indx
    |   |   |   |-- inst
    |   |   |   |-- ports
    |   |   |   `-- role
    |   |   |-- scsi_lu
    |   |   |   |-- creation_time
    |   |   |   |-- dev
    |   |   |   |-- dev_type
    |   |   |   |-- full_stat
    |   |   |   |-- hs_num_cmds
    |   |   |   |-- indx
    |   |   |   |-- inst
    |   |   |   |-- lu_name
    |   |   |   |-- lun
    |   |   |   |-- num_cmds
    |   |   |   |-- prod
    |   |   |   |-- read_mbytes
    |   |   |   |-- resets
    |   |   |   |-- rev
    |   |   |   |-- state_bit
    |   |   |   |-- status
    |   |   |   |-- vend
    |   |   |   `-- write_mbytes
    |   |   `-- scsi_tgt_dev
    |   |       |-- indx
    |   |       |-- inst
    |   |       |-- non_access_lus
    |   |       |-- num_lus
    |   |       |-- resets
    |   |       `-- status
    |   |-- udev_path
    |   `-- wwn
    |       |-- vpd_assoc_logical_unit
    |       |-- vpd_assoc_scsi_target_device
    |       |-- vpd_assoc_target_port
    |       |-- vpd_protocol_identifier
    |       `-- vpd_unit_serial
    `-- sch1
        |-- alias
        |-- alua
        |   `-- default_tg_pt_gp
        |       |-- alua_access_state
        |       |-- alua_access_status
        |       |-- alua_access_type
        |       |-- alua_write_metadata
        |       |-- members
        |       |-- nonop_delay_msecs
        |       |-- preferred
        |       |-- tg_pt_gp_id
        |       `-- trans_delay_msecs
        |-- alua_lu_gp
        |-- attrib
        |   |-- block_size
        |   |-- emulate_dpo
        |   |-- emulate_fua_read
        |   |-- emulate_fua_write
        |   |-- emulate_rest_reord
        |   |-- emulate_tas
        |   |-- emulate_tpu
        |   |-- emulate_tpws
        |   |-- emulate_ua_intlck_ctrl
        |   |-- emulate_write_cache
        |   |-- enforce_pr_isids
        |   |-- hw_block_size
        |   |-- hw_max_sectors
        |   |-- hw_queue_depth
        |   |-- is_nonrot
        |   |-- max_sectors
        |   |-- max_unmap_block_desc_count
        |   |-- max_unmap_lba_count
        |   |-- optimal_sectors
        |   |-- queue_depth
        |   |-- unmap_granularity
        |   `-- unmap_granularity_alignment
        |-- control
        |-- enable
        |-- info
        |-- pr
        |   |-- res_aptpl_active
        |   |-- res_aptpl_metadata
        |   |-- res_holder
        |   |-- res_pr_all_tgt_pts
        |   |-- res_pr_generation
        |   |-- res_pr_holder_tg_port
        |   |-- res_pr_registered_i_pts
        |   |-- res_pr_type
        |   `-- res_type
        |-- statistics
        |   |-- scsi_dev
        |   |   |-- indx
        |   |   |-- inst
        |   |   |-- ports
        |   |   `-- role
        |   |-- scsi_lu
        |   |   |-- creation_time
        |   |   |-- dev
        |   |   |-- dev_type
        |   |   |-- full_stat
        |   |   |-- hs_num_cmds
        |   |   |-- indx
        |   |   |-- inst
        |   |   |-- lu_name
        |   |   |-- lun
        |   |   |-- num_cmds
        |   |   |-- prod
        |   |   |-- read_mbytes
        |   |   |-- resets
        |   |   |-- rev
        |   |   |-- state_bit
        |   |   |-- status
        |   |   |-- vend
        |   |   `-- write_mbytes
        |   `-- scsi_tgt_dev
        |       |-- indx
        |       |-- inst
        |       |-- non_access_lus
        |       |-- num_lus
        |       |-- resets
        |       `-- status
        |-- udev_path
        `-- wwn
            |-- vpd_assoc_logical_unit
            |-- vpd_assoc_scsi_target_device
            |-- vpd_assoc_target_port
            |-- vpd_protocol_identifier
            `-- vpd_unit_serial

24 directories, 162 files

Thanks again,

Sean


-----Original Message-----
From: Nicholas A. Bellinger [mailto:nab@xxxxxxxxxxxxxxx] 
Sent: Tuesday, March 05, 2013 4:43 PM
To: Sean Liu
Cc: target-devel@xxxxxxxxxxxxxxx
Subject: RE: Exporting MHVTL devices via pscsi?

Hi Sean,

On Sat, 2013-03-02 at 22:39 -0500, Sean Liu wrote:
> Hi Nicholas,
> 
> I tried to use tcm_node to add the tape device with the patched tcm_pscsi.py but it did not seem to work.
> root@vUbuntu:/usr/local/lib/python2.7/dist-packages# 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
> root@vUbuntu:/usr/local/lib/python2.7/dist-packages# python 
> ./tcm_node.py --scsi=pscsi_3/st0 0:1:0 Calling pscsi createvirtdev: 
> path pscsi_3/st0 Calling pscsi createvirtdev: params 
> ['scsi_channel_id=0,scsi_target_id=1,scsi_lun_id=0']
> scsi_channel_id=0,scsi_target_id=1,scsi_lun_id=0
> Calling control_opt echo -n 
> scsi_channel_id=0,scsi_target_id=1,scsi_lun_id=0 > 
> /sys/kernel/config/target/core/pscsi_3/st0/control
> Calling enable_opt echo 1 > 
> /sys/kernel/config/target/core/pscsi_3/st0/enable
> pSCSI: createvirtdev failed for enable_opt with 
> scsi_channel_id=0,scsi_target_id=1,scsi_lun_id=0
> None
> 
> Following is the diff:
> root@vUbuntu:/usr/local/lib/python2.7/dist-packages# diff tcm_pscsi.py 
> ~/lio-utils/lio-utils/tcm-py/tcm_pscsi.py.backup
> 46c46
> < 	print "Calling pscsi createvirtdev: path " + path
> ---
> > #	print "Calling pscsi createvirtdev: path " + path
> 49c49
> < 	print "Calling pscsi createvirtdev: params " + str(params)
> ---
> > #	print "Calling pscsi createvirtdev: params " + str(params)
> 51,53c51
> < 	print pscsi_params
> < 
> < 	udev_path="/dev/null"
> ---
> > #	print pscsi_params
> 107,108d104
> < 		pscsi_params = "scsi_host_id=" + scsi_host_id + ",scsi_channel_id=" + scsi_channel_id + ",scsi_target_id=" + scsi_target_id + ",scsi_lun_id=" + scsi_lun_id.rstrip()
> < 		
> 114a111,113
> > 		pscsi_params = "scsi_host_id=" + scsi_host_id + 
> > ",scsi_channel_id=" + scsi_channel_id + ",scsi_target_id=" + 
> > scsi_target_id + ",scsi_lun_id=" + scsi_lun_id.rstrip()
> > 
> > 		
> 116c115
> < 	print "Calling control_opt " + control_opt
> ---
> > #	print "Calling control_opt " + control_opt
> 123c122
> < 	print "Calling enable_opt " + enable_opt
> ---
> > #	print "Calling enable_opt " + enable_opt
> 
> I must have missed something? I plea newbie with LIO/TCM...
> 

This patch does not match the work-around below..

Namely, the 'set_udev_path_op' assignment part is missing, which is
required to set udev_path before enabling the pSCSI backend device.   

Without setting some value for udev_path, pSCSI will fail at enable time as your encountering above.

Here's the patch again.

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


> Thanks,
> 
> Sean
> 
> -----Original Message-----
> From: Nicholas A. Bellinger [mailto:nab@xxxxxxxxxxxxxxx]
> Sent: Thursday, February 28, 2013 5:38 PM
> To: Sean Liu
> Cc: target-devel@xxxxxxxxxxxxxxx
> Subject: Re: Exporting MHVTL devices via pscsi?
> 
> 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



--
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


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux