[stgt] Document SCSI passthrough
Mark Harvey
markh794 at gmail.com
Fri Jul 30 11:34:23 CEST 2010
>From 797564b7ce4fa93d07d5bf5261e2e397a23ecdb5 Mon Sep 17 00:00:00 2001
From: Mark Harvey <markh794 at gmail.com>
Date: Fri, 30 Jul 2010 19:27:21 +1000
Subject: Document configuration for passthrough operation
A cut/paste of README.iscsi modified for passthrough device operation.
Signed-off-by: Mark Harvey <markh794 at gmail.com>
---
doc/README.passthrough | 601 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 601 insertions(+), 0 deletions(-)
diff --git a/doc/README.passthrough b/doc/README.passthrough
new file mode 100644
index 0000000..a1b6493
--- /dev/null
+++ b/doc/README.passthrough
@@ -0,0 +1,601 @@
+Preface
+-------------
+This show a simple example to set up some targets using existing
+targets on the host via /dev/sg paths.
+
+This example is using an IBM 3573-TL library with a single LTO4 drive.
+
+Physical tape library connected and configured to host:
+# lsscsi -g
+[0:0:0:0] disk MAXTOR ATLAS10K4_36SCA DFM0 /dev/sda /dev/sg0
+[0:0:6:0] process PE/PV 1x3 SCSI BP 1.1 - /dev/sg1
+[2:0:1:0] tape IBM ULT3580-TD4 8192 /dev/st1 /dev/sg4
+[2:0:1:1] mediumx IBM 3573-TL 6.50 - /dev/sg5
+
+
+Starting the daemon
+-------------
+The iSCSI target driver works with the 2.6.X kernels.
+
+First, you need to compile the source code:
+
+host:~/tgt/usr$ make ISCSI=1
+
+Try the following commands:
+
+host:~/tgt$ su
+host:~/tgt# ./usr/tgtd
+
+
+Configuration
+-------------
+Everyting is configured via the tgtadm management tool.
+
+The following example creates a target with id 1 (the iqn is
+iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz) and adds a
+logical unit (backed by /dev/sg4) with lun 1.
+
+Let's create one target devce.
+
+host:~/tgt$ su
+host:~/tgt# ./usr/tgtadm --lld iscsi --op new --mode target --tid 1 \
+ -T iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+
+You can get the current configuration:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ Account information:
+ ACL information:
+
+
+The controller device for management with lun 0 was created
+automatically. You can't remove it.
+
+Now it's time to add a logical unit to the target:
+ (The tape drive connected via /dev/sg4)
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op new --mode logicalunit \
+ --tid 1 --lun 1 --bstype=sg --device-type=pt -b /dev/sg4
+
+You can get the current configuration:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ LUN: 1
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg4
+ Backing store flags:
+ Account information:
+ ACL information:
+
+
+If you don't need to configure this target any more, enable the target
+to accept any initiators:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ LUN: 1
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg4
+ Backing store flags:
+ Account information:
+ ACL information:
+ ALL
+
+
+Note "ACL information" section. "ALL" means that this target accepts
+any initiators. The ACL feature also provides the access control based
+on initiators' addresses.
+
+First, let's remove "ALL" options:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op unbind --mode target --tid 1 -I ALL
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ LUN: 1
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg4
+ Backing store flags:
+ Account information:
+ ACL information:
+
+
+Here are some examples:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op bind --mode target --tid 1 -I 192.0.2.229
+host:~/tgt# ./usr/tgtadm --lld iscsi --op bind --mode target --tid 1 -I 198.51.100.0/24
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ LUN: 1
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg4
+ Backing store flags:
+ Account information:
+ ACL information:
+ 192.0.2.229
+ 198.51.100.0/24
+
+
+You can add lots of logical units:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op new --mode logicalunit \
+ --tid 1 --lun 2 --bstype=sg --device-type=pt -b /dev/sg5
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ LUN: 1
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg4
+ Backing store flags:
+ LUN: 2
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg5
+ Backing store flags:
+ Account information:
+ ACL information:
+
+
+You can get iSCSI parameters of the target:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target --tid 1
+MaxRecvDataSegmentLength=8192
+MaxXmitDataSegmentLength=8192
+HeaderDigest=None
+DataDigest=None
+InitialR2T=Yes
+MaxOutstandingR2T=1
+ImmediateData=Yes
+FirstBurstLength=65536
+MaxBurstLength=262144
+DataPDUInOrder=Yes
+DataSequenceInOrder=Yes
+ErrorRecoveryLevel=0
+IFMarker=No
+OFMarker=No
+DefaultTime2Wait=2
+DefaultTime2Retain=20
+OFMarkInt=Reject
+IFMarkInt=Reject
+MaxConnections=1
+
+
+You can chage iSCSI parameters like the folloing (e.g. set
+MaxRecvDataSegmentLength to 16384):
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --mode target --op update --tid 1 --name MaxRecvDataSegmentLength --value 16384
+
+You can get iSCSI parameters again to see it change:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target --tid 1
+MaxRecvDataSegmentLength=16384
+MaxXmitDataSegmentLength=8192
+HeaderDigest=None
+DataDigest=None
+InitialR2T=Yes
+MaxOutstandingR2T=1
+ImmediateData=Yes
+FirstBurstLength=65536
+MaxBurstLength=262144
+DataPDUInOrder=Yes
+DataSequenceInOrder=Yes
+ErrorRecoveryLevel=0
+IFMarker=No
+OFMarker=No
+DefaultTime2Wait=2
+DefaultTime2Retain=20
+OFMarkInt=Reject
+IFMarkInt=Reject
+MaxConnections=1
+
+
+The following is another example to enable header digest:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --mode target --op update --tid 1 --name HeaderDigest --value CRC32C
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target --tid 1
+MaxRecvDataSegmentLength=16384
+MaxXmitDataSegmentLength=8192
+HeaderDigest=CRC32C
+DataDigest=None
+InitialR2T=Yes
+MaxOutstandingR2T=1
+ImmediateData=Yes
+FirstBurstLength=65536
+MaxBurstLength=262144
+DataPDUInOrder=Yes
+DataSequenceInOrder=Yes
+ErrorRecoveryLevel=0
+IFMarker=No
+OFMarker=No
+DefaultTime2Wait=2
+DefaultTime2Retain=20
+OFMarkInt=Reject
+IFMarkInt=Reject
+MaxConnections=1
+
+The target accepts CRC32C and None. Currently, there is no way to
+configure a target to accept only CRC32C.
+
+
+Authentication
+-------------
+Let's create a new account:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op new --mode account --user fujita --password tomo
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode account
+Account list:
+ fujita
+
+You can assign this account to any targets:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op bind --mode account --tid 1 --user fujita
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ LUN: 1
+ Type: (null)
+ SCSI ID: IET 00010001
+ SCSI SN: beaf11
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg4
+ Backing store flags:
+ LUN: 2
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg5
+ Backing store flags:
+ Account information:
+ fujita
+ ACL information:
+ ALL
+
+
+You can set up an outgoing account. First, you need to create a new
+account like the previous example:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op new --mode account --user hoge --password deadbeaf
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode account
+Account list:
+ hoge
+ fujita
+host:~/tgt# ./usr/tgtadm --lld iscsi --op bind --mode account --tid 1 --user hoge --outgoing
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ LUN: 1
+ Type: (null)
+ SCSI ID: IET 00010001
+ SCSI SN: beaf11
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg4
+ Backing store flags:
+ LUN: 2
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg5
+ Backing store flags:
+ Account information:
+ fujita
+ hoge (outgoing)
+ ACL information:
+ ALL
+
+
+Initiator Information
+-------------
+After the target accepts initiators, the system information would be
+something like the followings:
+
+Linux open-iscsi initiator
+hostb:~ # iscsiadm -m discovery -t sendtargets -p 10.251.60.20
+10.251.60.20:3260,1 iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+hostb:~ # iscsiadm -m node -T iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz -p 10.251.60.20 --login
+Logging in to [iface: default, target: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz, portal: 10.251.60.20,3260]
+Login to [iface: default, target: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz, portal: 10.251.60.20,3260]: successful
+
+hostb:~ # lsscsi -g
+[0:0:0:0] cd/dvd TSSTcorp DVD-ROM TS-L333A D100 /dev/sr0 /dev/sg0
+[2:0:0:0] disk SEAGATE ST3400755SS NS25 /dev/sda /dev/sg1
+[2:0:1:0] disk SEAGATE ST3400755SS NS25 /dev/sdb /dev/sg2
+[3:0:0:0] disk DGC DISK 0429 /dev/sdc /dev/sg3
+[3:0:1:0] disk DGC DISK 0429 /dev/sdd /dev/sg4
+[11:0:0:0] storage IET Controller 0001 - /dev/sg5
+[11:0:0:1] tape IBM ULT3580-TD4 8192 /dev/st0 /dev/sg6
+[11:0:0:2] mediumx IBM 3573-TL 6.50 - /dev/sg7
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ I_T nexus: 2
+ Initiator: iqn.1987-05.com.cisco:01.4438aca09387
+ Connection: 0
+ IP Address: 192.0.2.115
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ LUN: 1
+ Type: (null)
+ SCSI ID: IET 00010001
+ SCSI SN: beaf11
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg4
+ Backing store flags:
+ LUN: 2
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg5
+ Backing store flags:
+ Account information:
+ ACL information:
+ ALL
+
+
+One initiator (192.0.2.113) logs in now. Let's try again:
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode target
+Target 1: iqn.2001-04.com.example:storage.vtl.amiens.sys1.xyz
+ System information:
+ Driver: iscsi
+ Status: running
+ I_T nexus information:
+ I_T nexus: 2
+ Initiator: iqn.1987-05.com.cisco:01.4438aca09387
+ Connection: 0
+ IP Address: 192.0.2.115
+ I_T nexus: 3
+ Initiator: iqn.1991-05.com.microsoft:kernel
+ Connection: 1
+ IP Address: 192.0.2.113
+ LUN information:
+ LUN: 0
+ Type: controller
+ SCSI ID: deadbeaf1:0
+ SCSI SN: beaf10
+ Size: 0
+ Backing store: No backing store
+ LUN: 1
+ Type: (null)
+ SCSI ID: IET 00010001
+ SCSI SN: beaf11
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg4
+ Backing store flags:
+ LUN: 2
+ Type: (null)
+ SCSI ID: IET 00010002
+ SCSI SN: beaf12
+ Size: 0 MB
+ Online: Yes
+ Removable media: No
+ Backing store type: sg
+ Backing store path: /dev/sg5
+ Backing store flags:
+ Account information:
+ ACL information:
+ ALL
+
+
+Now we have two initiators. You can see the parameters that the target
+and initiator negotiated (use the values follows "I_T nexus:"):
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode session --tid 1 --sid 3
+MaxRecvDataSegmentLength=8192
+MaxXmitDataSegmentLength=8192
+HeaderDigest=None
+DataDigest=None
+InitialR2T=Yes
+MaxOutstandingR2T=1
+ImmediateData=Yes
+FirstBurstLength=65536
+MaxBurstLength=262144
+DataPDUInOrder=Yes
+DataSequenceInOrder=Yes
+ErrorRecoveryLevel=0
+IFMarker=No
+OFMarker=No
+DefaultTime2Wait=2
+DefaultTime2Retain=20
+OFMarkInt=Reject
+IFMarkInt=Reject
+MaxConnections=1
+
+
+Performance tips
+-------------
+If you need multiple logical units, you had better create multiple
+targets including one logical unit instead of creating one target
+including multiple logical units.
+
+
+Shutdown
+-------------
+host:~/tgt# tgtadm --op unbind --mode target --tid 1 -I ALL
+host:~/tgt# tgtadm --op delete --mode conn --tid 1
+host:~/tgt# tgtadm --op delete --mode target --tid 1
+host:~/tgt# tgtadm --op delete --mode system
+
+
+iSNS
+-------------
+iSNS support is still experimental.
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode sys
+iSNS:
+ iSNS=Off
+ iSNSServerIP=
+ iSNSServerPort=3205
+ iSNSAccessControl=Off
+
+host:~/tgt# ./usr/tgtadm --op update --mode sys --name iSNSServerIP -v 192.0.2.113
+
+host:~/tgt# ./usr/tgtadm --op update --mode sys --name iSNS -v On
+
+host:~/tgt# ./usr/tgtadm --lld iscsi --op show --mode sys
+iSNS:
+ iSNS=On
+ iSNSServerIP=192.0.2.113
+ iSNSServerPort=3205
+ iSNSAccessControl=Off
+
+Now you are ready to add targets. Now there are some limitations:
+
+- once you enable iSNS, you can't disable it.
+- you need to enable iSNS before adding targets.
+
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list