Targetcli mappings

From FnordWiki
Jump to navigation Jump to search

Wherein we configure the gateway between a Ceph RBD and a Fibre Channel LUN.

Assumptions:

  • Fibre Channel fabric switch(es) are zoned appropriately
  • Gateway machine already has an RBD attached for use by the SCSI target subsystem
  • The gateway machine has a Qlogic HBA card installed and the module was given the qlini_mode=disabled or qlini_mode=dual arguments.
  • The initiator machine has an HBA that is not hardwired to target mode.

targetcli

adj@zarathud:~$ sudo targetcli
targetcli shell version 2.1.53
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> ls
o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- block .................................................................................................. [Storage Objects: 0]
  | o- fileio ................................................................................................. [Storage Objects: 0]
  | o- pscsi .................................................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................................................ [Storage Objects: 0]
  o- iscsi ............................................................................................................ [Targets: 0]
  o- loopback ......................................................................................................... [Targets: 0]
  o- qla2xxx .......................................................................................................... [Targets: 0]
  o- srpt ............................................................................................................. [Targets: 0]
  o- vhost ............................................................................................................ [Targets: 0]
  o- xen-pvscsi ....................................................................................................... [Targets: 0]
/> cd /backstores/block 
/backstores/block> create tanstaafl-lun-1 /dev/rbd/rbd/zarathud-fc-target-lun-1 
Created block storage object tanstaafl-lun-1 using /dev/rbd/rbd/zarathud-fc-target-lun-1.
/backstores/block> ls
o- block ...................................................................................................... [Storage Objects: 1]
  o- tanstaafl-lun-1 ..................................... [/dev/rbd/rbd/zarathud-fc-target-lun-1 (256.0GiB) write-thru deactivated]
    o- alua ....................................................................................................... [ALUA Groups: 1]
      o- default_tg_pt_gp ........................................................................... [ALUA state: Active/optimized]
/backstores/block> cd tanstaafl-lun-1/
/backstores/b...nstaafl-lun-1> status
Status for /backstores/block/tanstaafl-lun-1: /dev/rbd/rbd/zarathud-fc-target-lun-1 (256.0GiB) write-thru deactivated
/backstores/b...nstaafl-lun-1> ls /
o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- block .................................................................................................. [Storage Objects: 1]
  | | o- tanstaafl-lun-1 ................................. [/dev/rbd/rbd/zarathud-fc-target-lun-1 (256.0GiB) write-thru deactivated]
  | |   o- alua ................................................................................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | o- fileio ................................................................................................. [Storage Objects: 0]
  | o- pscsi .................................................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................................................ [Storage Objects: 0]
  o- iscsi ............................................................................................................ [Targets: 0]
  o- loopback ......................................................................................................... [Targets: 0]
  o- qla2xxx .......................................................................................................... [Targets: 0]
  o- srpt ............................................................................................................. [Targets: 0]
  o- vhost ............................................................................................................ [Targets: 0]
  o- xen-pvscsi ....................................................................................................... [Targets: 0]
/backstores/b...nstaafl-lun-1>

At this point, there is a block device waiting to be attached to the SCSI target interface. So let's configure a target port, attach that backing device to the target port, and create an ACL that lets the client server see that LUN.

adj@zarathud:~$ sudo targetcli
targetcli shell version 2.1.53
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/qla2xxx> cd /
/> ls
o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- block .................................................................................................. [Storage Objects: 1]
  | | o- tanstaafl-lun-1 ................................. [/dev/rbd/rbd/zarathud-fc-target-lun-1 (256.0GiB) write-thru deactivated]
  | |   o- alua ................................................................................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | o- fileio ................................................................................................. [Storage Objects: 0]
  | o- pscsi .................................................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................................................ [Storage Objects: 0]
  o- iscsi ............................................................................................................ [Targets: 0]
  o- loopback ......................................................................................................... [Targets: 0]
  o- qla2xxx .......................................................................................................... [Targets: 0]
  o- srpt ............................................................................................................. [Targets: 0]
  o- vhost ............................................................................................................ [Targets: 0]
  o- xen-pvscsi ....................................................................................................... [Targets: 0]
/> cd /qla2xxx 
/qla2xxx> info
Fabric module name: qla2xxx
ConfigFS path: /sys/kernel/config/target/qla2xxx
Allowed WWN types: naa
Allowed WWNs list: naa.10000090faa1b13d, naa.21000024ff5721ce, naa.10000090faa1b13c, naa.21000024ff5721cf
Fabric module features: acls
Corresponding kernel module: tcm_qla2xxx
/qla2xxx> create naa.21000024ff5721ce
Created target naa.21000024ff5721ce.
/qla2xxx> ls
o- qla2xxx ............................................................................................................ [Targets: 1]
  o- naa.21000024ff5721ce ............................................................................................... [gen-acls]
    o- acls .............................................................................................................. [ACLs: 0]
    o- luns .............................................................................................................. [LUNs: 0]
/qla2xxx> cd naa.21000024ff5721ce
/qla2xxx/naa.21000024ff5721ce> cd luns
/qla2xxx/naa....ff5721ce/luns> status
Status for /qla2xxx/naa.21000024ff5721ce/luns: LUNs: 0
/qla2xxx/naa....ff5721ce/luns> create /backstores/block/tanstaafl-lun-1 lun1
Created LUN 1.
/qla2xxx/naa....ff5721ce/luns> status
Status for /qla2xxx/naa.21000024ff5721ce/luns: LUNs: 1
/qla2xxx/naa....ff5721ce/luns> cd ../acls
/qla2xxx/naa....ff5721ce/acls> create 50060b0000672cfc
Created Node ACL for naa.50060b0000672cfc
Created mapped LUN 1.
/qla2xxx/naa....ff5721ce/acls>