tcm_loop

The Linux SCSI Target Wiki

(Difference between revisions)
Jump to: navigation, search
m
m
Line 34: Line 34:
-->
-->
-
'''tcm_loop''' is a virtual fabric module ([http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=tree;f=drivers/target/loopback;hb=HEAD tcm_loop.ko]) that can emulate any supported fabric type locally for the Linux Unified Target.
+
'''tcm_loop''' is a fabric module ([http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=tree;f=drivers/target/loopback;hb=HEAD tcm_loop.ko]) that can emulate any supported fabric type locally for the Linux Unified Target.
== Overview ==
== Overview ==

Revision as of 05:52, 4 July 2012

LIO Target
Logo
LIO 150513.png
tcm_loop SCSI Emulation Device
Original author(s) Nicholas Bellinger
Developer(s) Datera, Inc.
Initial release May 18, 2011 (2011-05-18)
Stable release 4.1.0 / June 20, 2012;
7 years ago
 (2012-06-20)
Preview release 4.2.0-rc5 / June 28, 2012;
7 years ago
 (2012-06-28)
Development status Production
Written in C
Operating system Linux
Type Fabric module
License GNU General Public License
Website datera.io
See Target for a complete overview over all fabric modules.
FILEIO with a tcm_loop SAS port on KVM x86_64 host running v2.6.34 with the new LSI Megasas 8708EM2 PPC HBA emulation into a Windows 7 x64 KVM Guest.

tcm_loop is a fabric module (tcm_loop.ko) that can emulate any supported fabric type locally for the Linux Unified Target.

Contents

Overview

tcm_loop provides full local SCSI device emulation (SPC-3 and SPC-4) for raw block storage objects. It thus makes any raw block device apear to the Target as a full SPC-3/SPC-4 SCSI compliant device with the corresponding CDB-level SAS emulation, for access from any SCSI LLD driver.

tcm_loop minimizes overhead - it delivers >12 GB/s (native) and >2 GB/s (from a single KVM guest, without hardware assist) on Intel Nehalem platforms. This provides e.g., unmodified guest operating systems, such as VMware ESX or VMware vSphere, to use the full SPC-3/SPC-4 SCSI functionality on any type of local raw block storage object they require.

tcm_loop was initially released on 10/19/2009,[1] and it went upstream into the Linux 2.6.39 kernel on 3/18/2011.[2]

targetcli

targetcli from Datera, Inc. is used to configure tcm_loop targets. targetcli aggregates service modules via a core library, and exports them through an API to the Unified Target, to provide a unified single-node SAN configuration shell, independently of the underlying fabric(s).

Startup

targetcli is invoked by running targetcli as root from the command prompt of the underlying OS shell. An initial setup as described in targetcli is assumed.

# targetcli
Welcome to targetcli:

 Copyright (c) 2012 by RisingTide Systems LLC.
 All rights reserved.

Visit us at http://www.risingtidesystems.com.

Using ib_srpt fabric module.
Using qla2xxx fabric module.
Using iscsi fabric module.
Using loopback fabric module.

/> loopback/ info
Fabric module name: loopback
ConfigFS path: /sys/kernel/config/target/loopback
Allowed WWN list type: naa
Fabric module specfile: /var/target/fabric/loopback.spec
Fabric module features: nexus
Corresponding kernel module: tcm_loop
/>

Instantiate a target

Instantiate a loopback target on the existing IBLOCK backstore device my_disk (as set up in targetcli):

/backstores/iblock/my_disk> /loopback create
Successfully created LUN 0.
Entering new node /loopback/naa.60014057f822d991/luns/lun0.
/loopback/naa...991/luns/lun0> 

targetcli automatically assigns the default ID '0' to the LUN, and then changes the working context to the new LUN. Now the target is created, and exports /dev/sdb as LUN 0.

Return to the root context, as no attributes need to be set or modified for a standard loopback target:

/loopback/naa...991/luns/lun0> cd /
/>

Display the object hierarchy

The resulting object hierarchy looks as follows (displayed from the root object):

/> ls
o- / ..................................................................... [...]
  o- backstores .......................................................... [...]
  | o- fileio ............................................... [0 Storage Object]
  | o- iblock ............................................... [1 Storage Object]
  | | o- my_disk .......................................... [/dev/sdb activated]
  | o- pscsi ................................................ [0 Storage Object]
  | o- rd_dr ................................................ [0 Storage Object]
  | o- rd_mcp ............................................... [0 Storage Object]
  o- ib_srpt ........................................................ [0 Target]
  o- iscsi .......................................................... [0 Target]
  o- loopback ....................................................... [1 Target]
  | o- naa.60014057f822d991 ............................. [naa.60014053485b9490]
  | | o- luns .......................................................... [1 LUN]
  | |   o- lun0 .................................... [iblock/my_disk (/dev/sbd)]
  o- qla2xxx ........................................................ [0 Target]
/>

Persist the configuration

The target configuration can be persisted across OS reboots by using saveconfig from the root context:

/> saveconfig
WARNING: Saving rtsnode1 current configuration to disk will overwrite your boot settings.
The current target configuration will become the default boot config.
Are you sure? Type 'yes': yes
Making backup of srpt/ConfigFS with timestamp: 2012-02-27_23:19:37.660264
Successfully updated default config /etc/target/srpt_start.sh
Making backup of qla2xxx/ConfigFS with timestamp: 2012-02-27_23:19:37.660264
Successfully updated default config /etc/target/qla2xxx_start.sh
Making backup of loopback/ConfigFS with timestamp: 2012-02-27_23:19:37.660264
Successfully updated default config /etc/target/loopback_start.sh
Making backup of LIO-Target/ConfigFS with timestamp: 2012-02-27_23:19:37.660264
Successfully updated default config /etc/target/lio_backup-2012-02-27_23:19:37.660264.sh
Making backup of Target_Core_Mod/ConfigFS with timestamp: 2012-02-27_23:19:37.660264
Successfully updated default config /etc/target/tcm_backup-2012-02-27_23:19:37.660264.sh
Generated Target_Core_Mod config: /etc/target/backup/tcm_backup-2012-02-27_23:19:37.660264.sh
Successfully updated default config /etc/target/lio_start.sh
Successfully updated default config /etc/target/tcm_start.sh
/>

Warning: Without saveconfig, the target configuration is ephemeral and will be lost upon rebooting or unloading the target service.

Spec file

RTS spec files define the fabric-dependent feature set, capabilities and available target ports of the specific underlying fabric. In particular, the tcm_loop spec file /var/target/fabric/loopback.spec is included via RTSlib.

# WARNING: This is a draft specfile supplied for demo purposes only.

# The loopback fabric module uses the default feature set
features = nexus

# Use naa WWNs
wwn_type = naa

# Non-standard module naming scheme
kernel_module = tcm_loop

# The configfs group
configfs_group = loopback

Specifications

The type of SCSI fabric features that are available with tcm_loop (Target mode emulated SAS ports) includes the complete set of SPC-3 logic in the Target engine including advanced features such as PRs, ALUA, etc.

tcm_loop supports high level fabric emulation. That is, depending on which WWN is used to create the configFS group in /sys/kernel/config/target/loopback/$WWN, it configures itself to return iSCSI, SAS or FC device identifiers for the SCSI LUN protocol identifiers in the EVPD 0x83 device identifier page.

The entire corresponding logic resides in target_core_fabric_lib.c, and is shared by the different target fabric modules. The code simply contains magic numbers defined for different protocols in SPC-4, and is commented using pieces directly from SPC-4.

Timeline

Timeline of the LinuxIO
Release Details 2011 2012 2013 2014 2015
123456789101112 123456789101112 123456789101112 123456789101112 123456789101112
4.x Version 4.0 4.1
Feature LIO Core Loop back FCoE iSCSI Perf SRP
CM WQ FC
USB
1394
vHost Perf Misc 16 GFC iSER Misc VAAI Misc DIF Core
NPIV
DIF iSER DIF FC vhost TCMU Xen Misc Misc virtio 1.0 Misc NVMe OF
Linux 2.6.38 2.6.39 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22

See also

Notes

  1. Nicholas Bellinger (10/19/2009). "[TCM_LOOP]: Add a virtual SCSI loopback fabric module". lkml.org. 
  2. Nicholas Bellinger (3/18/2011). "[SCSI] tcm_loop: Add multi-fabric Linux/SCSI LLD fabric module". lkml.org. 

External links

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox
Google AdSense