Tcm loop

The Linux SCSI Target Wiki

Revision as of 09:03, 20 October 2009 by Admin (Talk | contribs)
Jump to: navigation, search

The initial release of the TCM_Loop virtual SCSI fabric module for Target_Core_Mod/ConfigFS v3.2 has been committed into lio-core-2.6.git here patch

The source files can be view via kernel.org gitweb at lio-core-2.6.git/drivers/target/tcm_loop/

Contents

What is tcm_loop..?

TCM_Loop is a Target_Core_Mod/ConfigFS fabric module that provides locally accessable virtual Linux/SCSI devices from TCM storage objects such as IBLOCK and FILEIO. It allows TCM SPC-3 and above SCSI emulation to accessed via Linux/SCSI LLD driver, and provides CDB-level SAS emulation

What type of SCSI fabric features are available with tcm_loop..?

The complete set of Target_Core_Mod/ConfigFS SPC-3 logic including Persistent_Reservations and ALUA is available from the TCM_Loop Target mode emulated SAS ports.

What does tcm_loop.ko look like in action..?

Here is an example of creating two local virtual SCSI devices from a single TCM IBLOCK object.

  target:/usr/src/lio-utils.git# tcm_loop --createnexus 1
  Successfully created virtual SCSI I_T Nexus between TCM and Linux/SCSI HBA
    SAS Target Address: naa.600140554cf3a18e
    SAS Initiator Address naa.60014053226f0388
  target:/usr/src/lio-utils.git# tcm_loop --addlun naa.600140554cf3a18e 1 0 iblock_0/lvm_test0
  Successfully created SAS Target Port to local virtual SCSI Logical Unit
  target:/usr/src/lio-utils.git# tcm_loop --createnexus 1
  Successfully created virtual SCSI I_T Nexus between TCM and Linux/SCSI HBA
    SAS Target Address: naa.600140566ce31347
    SAS Initiator Address naa.6001405fd3afa2ef
  target:/usr/src/lio-utils.git# tcm_loop --addlun naa.600140566ce31347 1 0 iblock_0/lvm_test0
  Successfully created SAS Target Port to local virtual SCSI Logical Unit

tree /sys/kernel/config/target/loopback/

  /sys/kernel/config/target/loopback/
  |-- naa.600140554cf3a18e
  |   `-- tpgt_1
  |       |-- lun
  |       |   `-- lun_0
  |       |       `-- virtual_scsi_port -> ../../../../../../target/core/iblock_0/lvm_test0
  |       `-- nexus
  |           `-- naa.60014053226f0388
  |-- naa.600140566ce31347
  |   `-- tpgt_1
  |       |-- lun
  |       |   `-- lun_0
  |       |       `-- virtual_scsi_port -> ../../../../../../target/core/iblock_0/lvm_test0
  |       `-- nexus
  |           `-- naa.6001405fd3afa2ef
  `-- version

lsscsi -v output

  [9:0:1:0]    disk    LIO-ORG  IBLOCK           3.1   /dev/sdg 
    dir: /sys/bus/scsi/devices/9:0:1:0  [/sys/devices/tcm_loop_0/tcm_loop_adapter_0/host9/target9:0:1/9:0:1:0]
  [10:0:1:0]   disk    LIO-ORG  IBLOCK           3.1   /dev/sdh 
    dir: /sys/bus/scsi/devices/10:0:1:0  [/sys/devices/tcm_loop_0/tcm_loop_adapter_1/host10/target10:0:1/10:0:1:0]

dmesg output from two virtual SCSI devices pointing to the same TCM IBLOCK object on two different emulated SAS Target Addresses

  Target_Core_ConfigFS: REGISTER -> group: e1193d80 name: loopback
  Initialized TCM Loop Core Bus
  <<<<<<<<<<<<<<<<<<<<<< BEGIN FABRIC API >>>>>>>>>>>>>>>>>>>>>>
  Initialized struct target_fabric_configfs: df226208 for loopback
  <<<<<<<<<<<<<<<<<<<<<< END FABRIC API >>>>>>>>>>>>>>>>>>>>>>
  TCM_LOOP[0] - Set fabric -> tcm_loop_fabric_configfs
  Target_Core_ConfigFS: REGISTER -> Located fabric: loopback
  Target_Core_ConfigFS: REGISTER -> e17bcddc
  Target_Core_ConfigFS: REGISTER -> Allocated Fabric: loopback
  Target_Core_ConfigFS: REGISTER -> Set tf->tf_fabric for loopback
  scsi9 : TCM_Loopback
  TCM_Loop_ConfigFS: Allocated emulated Target SAS Address: naa.600140554cf3a18e at Linux/SCSI Host ID: 9
  TARGET_CORE[loopback]: Allocated Normal se_portal_group_t for endpoint: naa.600140554cf3a18e, Portal Tag: 1
  TCM_Loop_ConfigFS: Allocated Emulated SAS Target Port naa.600140554cf3a18e,t,0x0001
  loopback_TPG[1] - Added DYNAMIC ACL with TCQ Depth: 1 for loopback Initiator Node: naa.60014053226f0388
  TARGET_CORE[loopback]: Registered fabric_sess_ptr: d43376e8
  TCM_Loop_ConfigFS: Established I_T Nexus to emulated SAS Initiator Port: naa.60014053226f0388
  iblock/loopback: Adding to default ALUA Target Port Group: alua/default_tg_pt_gp
  loopback_TPG[1]_LUN[0] - Activated loopback Logical Unit from CORE HBA: 3
  TARGET_CORE[loopback]->TPG[1]_LUN[0] - Adding READ-WRITE access for LUN in Demo Mode
  TCM_Loop_ConfigFS: Port Link Successful
  scsi 9:0:1:0: Direct-Access     LIO-ORG  IBLOCK           3.1  PQ: 0 ANSI: 5
  sd 9:0:1:0: Attached scsi generic sg7 type 0
  sd 9:0:1:0: [sdg] READ CAPACITY(16) failed
  sd 9:0:1:0: [sdg] Result: hostbyte=0x05 driverbyte=0x00
  sd 9:0:1:0: [sdg] Sense not available.
  sd 9:0:1:0: [sdg] 3072000 512-byte logical blocks: (1.57 GB/1.46 GiB)
  sd 9:0:1:0: [sdg] Write Protect is off
  sd 9:0:1:0: [sdg] Mode Sense: 2f 00 00 00
  sd 9:0:1:0: [sdg] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
  sd 9:0:1:0: [sdg] READ CAPACITY(16) failed
  sd 9:0:1:0: [sdg] Result: hostbyte=0x05 driverbyte=0x00
  sd 9:0:1:0: [sdg] Sense not available.
   sdg: unknown partition table
  sd 9:0:1:0: [sdg] READ CAPACITY(16) failed
  sd 9:0:1:0: [sdg] Result: hostbyte=0x05 driverbyte=0x00
  sd 9:0:1:0: [sdg] Sense not available.
  sd 9:0:1:0: [sdg] Attached SCSI disk
  scsi10 : TCM_Loopback
  TCM_Loop_ConfigFS: Allocated emulated Target SAS Address: naa.600140566ce31347 at Linux/SCSI Host ID: 10
  TARGET_CORE[loopback]: Allocated Normal se_portal_group_t for endpoint: naa.600140566ce31347, Portal Tag: 1
  TCM_Loop_ConfigFS: Allocated Emulated SAS Target Port naa.600140566ce31347,t,0x0001
  loopback_TPG[1] - Added DYNAMIC ACL with TCQ Depth: 1 for loopback Initiator Node: naa.6001405fd3afa2ef
  TARGET_CORE[loopback]: Registered fabric_sess_ptr: d4337a28
  TCM_Loop_ConfigFS: Established I_T Nexus to emulated SAS Initiator Port: naa.6001405fd3afa2ef
  iblock/loopback: Adding to default ALUA Target Port Group: alua/default_tg_pt_gp
  loopback_TPG[1]_LUN[0] - Activated loopback Logical Unit from CORE HBA: 3
  TARGET_CORE[loopback]->TPG[1]_LUN[0] - Adding READ-WRITE access for LUN in Demo Mode
  TCM_Loop_ConfigFS: Port Link Successful
  scsi 10:0:1:0: Direct-Access     LIO-ORG  IBLOCK           3.1  PQ: 0 ANSI: 5
  sd 10:0:1:0: Attached scsi generic sg8 type 0
  sd 10:0:1:0: [sdh] READ CAPACITY(16) failed
  sd 10:0:1:0: [sdh] Result: hostbyte=0x05 driverbyte=0x00
  sd 10:0:1:0: [sdh] Sense not available.
  sd 10:0:1:0: [sdh] 3072000 512-byte logical blocks: (1.57 GB/1.46 GiB)
  sd 10:0:1:0: [sdh] Write Protect is off
  sd 10:0:1:0: [sdh] Mode Sense: 2f 00 00 00
  sd 10:0:1:0: [sdh] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
  sd 10:0:1:0: [sdh] READ CAPACITY(16) failed
  sd 10:0:1:0: [sdh] Result: hostbyte=0x05 driverbyte=0x00
  sd 10:0:1:0: [sdh] Sense not available.
   sdh: unknown partition table
  sd 10:0:1:0: [sdh] READ CAPACITY(16) failed
  sd 10:0:1:0: [sdh] Result: hostbyte=0x05 driverbyte=0x00
  sd 10:0:1:0: [sdh] Sense not available.
  sd 10:0:1:0: [sdh] Attached SCSI disk
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Google AdSense