Target/configFS
The Linux SCSI Target Wiki
![]() | |
---|---|
LinuxIO | |
Original author(s) | Nicholas Bellinger |
Developer(s) | Datera, Inc. |
Initial release | January 14, 2011 |
Stable release | 4.1.0 / June 20, 2012 |
Preview release | 4.2.0-rc5 / June 28, 2012 |
Development status | Production |
Written in | C |
Operating system | Linux |
Type | Target engine |
License | GNU General Public License |
Website | datera.io |
Target/configFS describes the configFS kernel programming interface for the LinuxIO engine. ConfigFS is a RAM-based virtual file system provided by the 2.6 Linux kernel, originally based on sysfs code and developed as a hybrid control mechanism for OCFS2.
configFS uses symbolic links for inter- and intra-modules configuration.
Contents |
Introduction
To setup the LinuxIO, targetcli should be used. targetcli is a comprehensive, powerful, yet easy storage management tool from Datera that can efficiently handle complex LIO installations.
This page describes the resulting low-level user-space configuration of the LIO configFS object tree. The LIO core is mapped into configFS at /sys/kernel/config/target/. A $TARGET
shell variable is defined to point to it:
export TARGET=/sys/kernel/config/target/core/
Setup
The following examples show the setup for each LIO backstore storage object respectively: IBLOCK, PSCSI, RAMDISK, and FILEIO. In these examples, the LinuxIO is configured by directly poking its configFS interface. In production, of course, targetcli provides management tool that is much more convenient and usable.
Generic
# BEGIN CONFIGFS CODE FOR GENERIC TARGET ENGINE modprobe target_core_mod # Set up our shell variables export CONFIGFS=/sys/kernel/config/ export TARGET=/sys/kernel/config/target/core/ export FABRIC=/sys/kernel/config/target/iscsi/ # END CONFIGFS CODE FOR GENERIC TARGET ENGINE
Setting up IBLOCK
# BEGIN IBLOCK SUBSYSTEM PLUGIN EXPORT mkdir -p $TARGET/iblock_0/lvm_test0 # This enabled NAA WWN 0x83 VPN descriptors echo a97e4ce21c0711de829b000c2943d57b > $TARGET/iblock_0/lvm_test0/wwn/vpd_unit_serial # Either major/minor method for referencing struct block_device, or # echo iblock_major=254,iblock_minor=2 > $TARGET/iblock_0/lvm_test0/control # echo 1 > $TARGET/iblock_0/lvm_test0/enable # Locate the struct block_device from passed file descriptor.. exec 3<>/dev/lio-test/test0 echo 3 > $TARGET/iblock_0/lvm_test0/fd exec 3>&- # Enable 4096 sector size emulation echo 4096 > $TARGET/iblock_0/lvm_test0/attrib/block_size # More tunables for target_core_mod # echo 0 > $TARGET/iblock_0/lvm_test0/attrib/emulate_tas echo 0 > $TARGET/iblock_0/lvm_test0/attrib/emulate_ua_intlck_ctrl # END IBLOCK SUBSYSTEM PLUGIN EXPORT
Setting up PSCSI
# EBGIN PSCSI SUBSYSTEM PLUGIN EXPORT mkdir -p $TARGET/pscsi_0/sdd # This is only limited to T10 vendor type WWN naming.. echo 66e418b4-e9ab-11dd-8f51-000c2943d57b > $TARGET/pscsi_0/sdd/wwn/vpd_unit_serial # Either, Linux/SCSI HCTL method of locating struct scsi_device, or # echo scsi_channel_id=0,scsi_target_id=3,scsi_lun_id=0 > $TARGET/pscsi_0/sdd/control # echo 1 > $TARGET/pscsi_0/sdd/enable # Locate the struct scsi_device from file descriptor (only for TYPE_DISK+TYPE_ROM) exec 3<>/dev/sdd echo 3 > $TARGET/pscsi_0/sdd/fd exec 3>&- # END PSCSI SUBSYSTEM PLUGIN EXPORT
Setting up a RAMDISK
# START RAMDISK SUBSYSTEM PLUGIN OBJECTS mkdir -p $TARGET/rd_mcp_0/ramdisk echo rd_pages=32768 > $TARGET/rd_mcp_0/ramdisk/control echo 1 > $TARGET/rd_mcp_0/ramdisk/enable # END RAMDISK SUBSYSTEM PLUGIN OBJECTS
Setting up FILEIO
# START FILEIO SUBSYSTEM PLUGIN OBJECTS mkdir -p $TARGET/fileio_0/fileio # Note that using a backing struct block_device for fd_dev_name will automatically # locate fd_dev_size, otherwise this value is in bytes.. echo "fd_dev_name=/dev/sde,fd_dev_size=134217728" > $TARGET/fileio_0/fileio/control echo 1 > $TARGET/fileio_0/fileio/enable # END FILEIO SUBSYSTEM PLUGIN OBJECTS
Object tree
Here is what a running LIO looks like for configFS via tree:
/sys/kernel/config/target/core/ |-- alua | |-- lu_gps | | `-- default_lu_gp | | |-- alua_access_state | | |-- lu_gp_id | | `-- members | `-- tg_pt_gps | `-- default_tg_pt_gp | |-- alua_access_state | |-- members | `-- tg_pt_gp_id |-- fileio_0 | |-- fileio | | |-- alua_lu_gp | | |-- attrib | | | |-- block_size | | | |-- emulate_tas | | | |-- emulate_ua_intlck_ctrl | | | |-- hw_block_size | | | |-- hw_max_sectors | | | |-- hw_queue_depth | | | |-- max_sectors | | | |-- queue_depth | | | `-- task_timeout | | |-- control | | |-- enable | | |-- fd | | |-- info | | |-- pr | | | |-- 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 | | `-- wwn | | |-- vpd_assoc_logical_unit | | |-- vpd_assoc_scsi_target_device | | |-- vpd_assoc_target_port | | |-- vpd_protocol_identifier | | `-- vpd_unit_serial | `-- hba_info |-- iblock_0 | |-- hba_info | `-- lvm_test0 | |-- alua_lu_gp | |-- attrib | | |-- block_size | | |-- emulate_tas | | |-- emulate_ua_intlck_ctrl | | |-- hw_block_size | | |-- hw_max_sectors | | |-- hw_queue_depth | | |-- max_sectors | | |-- queue_depth | | `-- task_timeout | |-- control | |-- enable | |-- fd | |-- info | |-- pr | | |-- 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 | `-- wwn | |-- vpd_assoc_logical_unit | |-- vpd_assoc_scsi_target_device | |-- vpd_assoc_target_port | |-- vpd_protocol_identifier | `-- vpd_unit_serial |-- pscsi_0 | |-- hba_info | `-- sdd | |-- alua_lu_gp | |-- attrib | | |-- block_size | | |-- emulate_tas | | |-- emulate_ua_intlck_ctrl | | |-- hw_block_size | | |-- hw_max_sectors | | |-- hw_queue_depth | | |-- max_sectors | | |-- queue_depth | | `-- task_timeout | |-- control | |-- enable | |-- fd | |-- info | |-- pr | | |-- 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 | `-- wwn | |-- vpd_assoc_logical_unit | |-- vpd_assoc_scsi_target_device | |-- vpd_assoc_target_port | |-- vpd_protocol_identifier | `-- vpd_unit_serial `-- rd_mcp_0 |-- hba_info `-- ramdisk |-- alua_lu_gp |-- attrib | |-- block_size | |-- emulate_tas | |-- emulate_ua_intlck_ctrl | |-- hw_block_size | |-- hw_max_sectors | |-- hw_queue_depth | |-- max_sectors | |-- queue_depth | `-- task_timeout |-- control |-- enable |-- fd |-- info |-- pr | |-- 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 `-- wwn |-- vpd_assoc_logical_unit |-- vpd_assoc_scsi_target_device |-- vpd_assoc_target_port |-- vpd_protocol_identifier `-- vpd_unit_serial 25 directories, 114 files
Kernel ring buffer
Here is the kernel ring buffer output of a successfully starting LIO engine (see /sys/kernel/config/
):
TARGET_CORE[0]: Loading Generic Kernel Storage Engine: v3.0.0 on Linux/i686 on 2.6.29 TARGET_CORE[0]: Initialized ConfigFS Fabric Infrastructure: v1.0.0 on Linux/i686 on 2.6.29 SE_PC[0] - Registered Plugin Class: TRANSPORT PLUGIN_TRANSPORT[1] - pscsi registered PLUGIN_TRANSPORT[4] - iblock registered PLUGIN_TRANSPORT[5] - rd_dr registered PLUGIN_TRANSPORT[6] - rd_mcp registered PLUGIN_TRANSPORT[7] - fileio registered SE_PC[1] - Registered Plugin Class: OBJ PLUGIN_OBJ[1] - dev registered Target_Core_ConfigFS: Located se_plugin: def1d890 plugin_name: iblock hba_type: 4 plugin_dep_id: 0 CORE_HBA[0] - Linux-iSCSI.org iBlock HBA Driver 3.0 on Generic Target Core Stack v3.0 CORE_HBA[0] - Attached iBlock HBA: 0 to Generic Target Core TCQ Depth: 512 CORE_HBA[0] - Attached HBA to Generic Target Core IBLOCK: Allocated ib_dev for lvm_test0 Target_Core_ConfigFS: Allocated se_subsystem_dev_t: def1e800 se_dev_su_ptr: df3e8400 Target_Core_ConfigFS: Set emulated VPD Unit Serial: a97e4ce21c0711de829b000c2943d57b IBLOCK: Claiming struct block_device: df64f740 bio: create slab <bio-1> at 1 IBLOCK: Created bio_set() for major/minor: 254:2 iblock: Using SPC3_PERSISTENT_RESERVATIONS emulation iblock: Enabling ALUA Emulation for SPC-3 device iblock: Adding to default ALUA LU Group: core/alua/lu_gps/default_lu_gp CORE_iBLOCK[0] - Activating Device with TCQ: 0 at Major: 254 Minor 2 Vendor: LIO-ORG Model: IBLOCK Revision: 3.0 Type: Direct-Access ANSI SCSI revision: 05 T10 VPD Unit Serial Number: a97e4ce21c0711de829b000c2943d57b T10 VPD Page Length: 72 T10 VPD Identifer Length: 16 T10 VPD Identifier Association: addressed logical unit T10 VPD Identifier Type: NAA T10 VPD Binary Device Identifier: 36001405a97e4ce21c0711de829b000c2 T10 VPD Identifer Length: 48 T10 VPD Identifier Association: addressed logical unit T10 VPD Identifier Type: T10 Vendor ID based T10 VPD ASCII Device Identifier: LIO-ORG Target_Core_ConfigFS: Registered iblock se_dev->se_dev_ptr: d4354000 from fd dev[d4354000]: SE Device block_size changed to 4096 dev[d4354000]: SE Device UA_INTRLCK_CTRL flag: 0 Target_Core_ConfigFS: Located se_plugin: def1d824 plugin_name: pscsi hba_type: 1 plugin_dep_id: 0 CORE_HBA[1] - Linux-iSCSI.org SCSI HBA Driver v3.0 on Generic Target Core Stack v3.0 CORE_HBA[1] - MPT SPI Host CORE_HBA[1] - Attached SCSI HBA to Generic Target Core with TCQ Depth: 127 MaxSectors: 8192 CORE_HBA[1] - Attached HBA to Generic Target Core PSCSI: Allocated pdv: d4384e60 for sdd Target_Core_ConfigFS: Allocated se_subsystem_dev_t: def1e000 se_dev_su_ptr: d4384e60 Target_Core_ConfigFS: Set emulated VPD Unit Serial: 66e418b4-e9ab-11dd-8f51-000c2943d57b PSCSI: Claiming def68800 Major:Minor - 8:48 pscsi: Using SPC_PASSTHROUGH, no reservation emulation pscsi: Using SPC_ALUA_PASSTHROUGH, no ALUA emulation CORE_PSCSI[0] - Activating Device with TCQ: 32 at SCSI Location (Channel/Target/LUN) 0/3/0 Vendor: VMware, Model: VMware Virtual S Revision: 1.0 Type: Direct-Access ANSI SCSI revision: 02 PSCSI Status Byte exception at task: ded5c000 CDB: 0x12 Result: 0x08000002 CORE_PSCSI[0] - Added TYPE_DISK for 0:3:0 Target_Core_ConfigFS: Registered pscsi se_dev->se_dev_ptr: d4354400 from fd Target_Core_ConfigFS: Located se_plugin: def1d8d8 plugin_name: rd_mcp hba_type: 6 plugin_dep_id: 0 CORE_HBA[2] - Linux-iSCSI.org Ramdisk HBA Driver v3.0 on Generic Target Core Stack v3.0 CORE_HBA[2] - Attached Ramdisk HBA: 0 to Generic Target Core TCQ Depth: 256 MaxSectors: 1024 CORE_HBA[2] - Attached HBA to Generic Target Core Target_Core_ConfigFS: Allocated se_subsystem_dev_t: def1c000 se_dev_su_ptr: d3541500 RAMDISK: Referencing Page Count: 32768 CORE_RD[0] - Built Ramdisk Device ID: 0 space of 32768 pages in 11 tables rd_mcp: Using SPC3_PERSISTENT_RESERVATIONS emulation rd_mcp: Enabling ALUA Emulation for SPC-3 device rd_mcp: Adding to default ALUA LU Group: core/alua/lu_gps/default_lu_gp CORE_RD[0] - Activating Device with TCQ: 0 at Ramdisk Device ID: 0 Vendor: LIO-ORG Model: RAMDISK-MCP Revision: 3.0 Type: Direct-Access ANSI SCSI revision: 05 T10 VPD Unit Serial Number: 1234567890:2_0 T10 VPD Page Length: 39 T10 VPD Identifer Length: 35 T10 VPD Identifier Association: addressed logical unit T10 VPD Identifier Type: T10 Vendor ID based T10 VPD ASCII Device Identifier: LIO-ORG CORE_RD[0] - Added LIO MEMCPY Ramdisk Device ID: 0 of 32768 pages in 11 tables, 134217728 total bytes Target_Core_ConfigFS: Registered se_dev->se_dev_ptr: d4355800 Target_Core_ConfigFS: Located se_plugin: def1d8fc plugin_name: fileio hba_type: 7 plugin_dep_id: 0 CORE_HBA[3] - Linux-iSCSI.org FILEIO HBA Driver 3.0 on Generic Target Core Stack v3.0 CORE_HBA[3] - Attached FILEIO HBA: 0 to Generic Target Core with TCQ Depth: 256 MaxSectors: 1024 CORE_HBA[3] - Attached HBA to Generic Target Core FILEIO: Allocated fd_dev for d436f448 Target_Core_ConfigFS: Allocated se_subsystem_dev_t: de984000 se_dev_su_ptr: d4385400 FILEIO: Referencing Path: /dev/sde FILEIO: Referencing Size: 134217728 bytes FILEIO: Claiming d4385400 Major:Minor - 8:64 FILEIO: Using size: 428867072 bytes from struct block_device blocks: 837631 hardsect_size: 512 fileio: Using SPC3_PERSISTENT_RESERVATIONS emulation fileio: Enabling ALUA Emulation for SPC-3 device fileio: Adding to default ALUA LU Group: core/alua/lu_gps/default_lu_gp CORE_FILE[0] - Activating Device with TCQ: 0 at FILEIO Device ID: 0 Vendor: LIO-ORG Model: FILEIO Revision: 3.0 Type: Direct-Access ANSI SCSI revision: 05 T10 VPD Unit Serial Number: 1234567890:3_0 T10 VPD Page Length: 34 T10 VPD Identifer Length: 30 T10 VPD Identifier Association: addressed logical unit T10 VPD Identifier Type: T10 Vendor ID based T10 VPD ASCII Device Identifier: LIO-ORG CORE_FILE[0] - Added LIO FILEIO Device ID: 0 at /dev/sde, 428867072 total bytes Target_Core_ConfigFS: Registered se_dev->se_dev_ptr: d4355c00