ISCSI-COMSTAR

From pressy's brainbackup
Jump to: navigation, search

iSCSI with Comstar

COMSTAR utilizes a SCSI Target Mode Framework (STMF) to manage target storage devices. You could use Solaris 11 with COMSTAR to provide iSCSI, FC, FCoE or SRP devices. I will use it for iSCSI:

First, we have to prepare the server

root@vsol01:~# pkg install group/feature/storage-server
root@vsol01:~# svcs -a | grep stmf
disabled       11:31:09 svc:/system/stmf:default
root@vsol01:~# svcadm enable stmf
root@vsol01:~# svcs -a | grep stmf
online         11:47:44 svc:/system/stmf:default
root@vsol01:~#
root@vsol01:~# zfs create -o mountpoint=none space01/iscsi
root@vsol01:~# zfs create -V 20g  space01/iscsi/lun0-clnodes
root@vsol01:~#
root@vsol01:~# zfs list -t volume
NAME                         USED  AVAIL  REFER  MOUNTPOINT
rpool/dump                  1.03G  22.2G  1.00G  -
rpool/swap                  1.03G  22.2G  1.00G  -
space01/iscsi/lun0-clnodes  20.6G  67.1G    16K  -
root@vsol01:~#
root@vsol01:~#
root@vsol01:~# stmfadm create-lu /dev/zvol/rdsk/space01/iscsi/lun0-clnodes
Logical unit created: 600144F0DE794B00000053A403AA0001
root@vsol01:~#
root@vsol01:~# stmfadm list-lu
LU Name: 600144F0DE794B00000053A403AA0001
root@vsol01:~# stmfadm add-view 600144F0DE794B00000053A403AA0001
root@vsol01:~# stmfadm list-view -l 600144F0DE794B00000053A403AA0001
View Entry: 0
    Host group   : All
    Target Group : All
    LUN          : Auto
root@vsol01:~#
root@vsol01:~# svcadm enable -r svc:/network/iscsi/target:default
root@vsol01:~#
root@vsol01:~# itadm create-target
Target iqn.1986-03.com.sun:02:62e5000a-e103-cf38-d3c3-9b206fb59170 successfully created
root@vsol01:~#
root@vsol01:~# itadm list-target -v
TARGET NAME                                                  STATE    SESSIONS
iqn.1986-03.com.sun:02:62e5000a-e103-cf38-d3c3-9b206fb59170  online   0
        alias:                  -
        auth:                   none (defaults)
        targetchapuser:         -
        targetchapsecret:       unset
        tpg-tags:               default
root@vsol01:~#

And now the client... easy setup, no ACL, no authentication

root@clnode01:~#  svcadm enable network/iscsi/initiator
root@clnode01:~# iscsiadm add static-config iqn.1986-03.com.sun:02:62e5000a-e103-cf38-d3c3-9b206fb59170,192.168.56.100
root@clnode01:~# iscsiadm list static-config
Static Configuration Target: iqn.1986-03.com.sun:02:62e5000a-e103-cf38-d3c3-9b206fb59170,192.168.56.100:3260
root@clnode01:~#
root@clnode01:~# iscsiadm list static-config
Static Configuration Target: iqn.1986-03.com.sun:02:62e5000a-e103-cf38-d3c3-9b206fb59170,192.168.56.100:3260
root@clnode01:~# iscsiadm add discovery-address 192.168.56.100
root@clnode01:~# iscsiadm modify discovery --sendtargets enable
root@clnode01:~# iscsiadm modify discovery --static enable
root@clnode01:~# devfsadm -i iscsi
root@clnode01:~# echo | format
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t600144F0DE794B00000053A403AA0001d0 <SUN-COMSTAR-1.0 cyl 2608 alt 2 hd 255 sec 63>
          /scsi_vhci/disk@g600144f0de794b00000053a403aa0001
       1. c7t0d0 <ATA-VBOX HARDDISK-1.0-20.00GB>
          /pci@0,0/pci8086,2829@d/disk@0,0
Specify disk (enter its number): Specify disk (enter its number):
root@clnode01:~#
root@clnode01:~#

another try on s11.3 with ACLs

==== iSCSI @ 11.3 ====


root@msun01:~# pkg install group/feature/storage-server
           Packages to install:  31
            Services to change:   1
       Create boot environment:  No
Create backup boot environment: Yes

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                              31/31     4833/4833  142.0/142.0  1.4M/s

PHASE                                          ITEMS
Installing new actions                     6312/6312
Updating package state database                 Done
Updating package cache                           0/0
Updating image state                            Done
Creating fast lookup database                   Done
Updating package cache                           1/1
root@msun01:~#
root@msun01:~# svcs -a | grep stmf
disabled       10:22:08 svc:/system/stmf:default
root@msun01:~# svcadm enable stmf
root@msun01:~#
root@msun01:~# zfs create -o mountpoint=none  rpool/iscsi
root@msun01:~# zfs create -V 5g -s rpool/iscsi/iscsi-hdd0
root@msun01:~#
root@msun01:~# stmfadm create-lu /dev/zvol/rdsk/rpool/iscsi/iscsi-hdd0
Logical unit created: 600144F0000B5DE2535E57F4BB4B0001
root@msun01:~#
root@msun01:~# stmfadm list-lu
LU Name: 600144F0000B5DE2535E57F4BB4B0001
root@msun01:~#
root@msun01:~# stmfadm add-view 600144F0000B5DE2535E57F4BB4B0001
root@msun01:~# stmfadm list-view -l 600144F0000B5DE2535E57F4BB4B0001
View Entry: 0
    Host group   : All
    Target Group : All
    LUN          : 0
root@msun01:~#
root@msun01:~# svcadm enable -r svc:/network/iscsi/target:default
root@msun01:~# svcs -l iscsi/target
fmri         svc:/network/iscsi/target:default
name         iscsi target
enabled      true
state        online
next_state   none
state_time   Wed Oct 05 10:41:45 2016
logfile      /var/svc/log/network-iscsi-target:default.log
restarter    svc:/system/svc/restarter:default
manifest     /lib/svc/manifest/network/iscsi/iscsi-target.xml
dependency   require_any/error svc:/milestone/network (online)
dependency   require_all/none svc:/system/stmf:default (online)
root@msun01:~#
root@msun01:~# itadm create-target
Target iqn.1986-03.com.sun:02:40c77c45-8a30-43e9-a570-a3a441815608 successfully created
root@msun01:~# itadm list-target -v
TARGET NAME                                                  STATE    SESSIONS
iqn.1986-03.com.sun:02:40c77c45-8a30-43e9-a570-a3a441815608  online   0
        alias:                  -
        auth:                   none (defaults)
        targetchapuser:         -
        targetchapsecret:       unset
        tpg-tags:               default
root@msun01:~#
root@msun01:~# sbdadm list-lu

Found 1 LU(s)

              GUID                    DATA SIZE           SOURCE
--------------------------------  -------------------  ----------------
600144f0000b5de2535e57f4bb4b0001  5368709120           /dev/zvol/rdsk/rpool/iscsi/iscsi-hdd0
root@msun01:~#

-------------------------------

Client

root@psvsparc2:~# svcadm enable /network/iscsi/initiator
root@psvsparc2:~# iscsiadm add discovery-address 10.52.72.90
root@psvsparc2:~# iscsiadm modify discovery --sendtargets enable
root@psvsparc2:~# echo | format
Searching for disks...done

c0t600144F0000B5DE2535E57F4BB4B0001d0: configured with capacity of 5.00GB


AVAILABLE DISK SELECTIONS:
       0. c0t600144F0000B5DE2535E57F4BB4B0001d0 <SUN-COMSTAR-1.0 cyl 2558 alt 2 hd 128 sec 32>
          /scsi_vhci/ssd@g600144f0000b5de2535e57f4bb4b0001
       1. c2t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
          /pci@0/pci@0/pci@2/scsi@0/sd@0,0
       2. c2t1d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
          /pci@0/pci@0/pci@2/scsi@0/sd@1,0
Specify disk (enter its number): Specify disk (enter its number):
root@psvsparc2:~# zpool create iscsi c0t600144F0000B5DE2535E57F4BB4B0001d0
root@psvsparc2:~# zpool list iscsi
NAME    SIZE  ALLOC   FREE  CAP  DEDUP  HEALTH  ALTROOT
iscsi  4.97G   112K  4.97G   0%  1.00x  ONLINE  -
root@psvsparc2:~#



-----------------------------
Second LUN
root@msun01:~# zfs create -V 5g -s rpool/iscsi/iscsi-hdd1
root@msun01:~# stmfadm create-lu /dev/zvol/rdsk/rpool/iscsi/iscsi-hdd1
Logical unit created: 600144F0000B5DE2535E57F4C0210002
root@msun01:~# stmfadm add-view 600144F0000B5DE2535E57F4C0210002
root@msun01:~#
root@msun01:~#
root@msun01:~#
root@msun01:~# itadm create-target
Target iqn.1986-03.com.sun:02:0454adc7-7476-4027-8f05-dde5e03bd4fd successfully created
root@msun01:~#
root@msun01:~# stmfadm list-lu
LU Name: 600144F0000B5DE2535E57F4BB4B0001
LU Name: 600144F0000B5DE2535E57F4C0210002
root@msun01:~# stmfadm list-lu -v
LU Name: 600144F0000B5DE2535E57F4BB4B0001
    Operational Status     : Online
    Provider Name          : sbd
    Alias                  : /dev/zvol/rdsk/rpool/iscsi/iscsi-hdd0
    View Entry Count       : 1
    Data File              : /dev/zvol/rdsk/rpool/iscsi/iscsi-hdd0
    Meta File              : not set
    Size                   : 5368709120
    Block Size             : 512
    Management URL         : not set
    Vendor ID              : SUN
    Product ID             : COMSTAR
    Serial Num             : not set
    Write Protect          : Disabled
    Write Cache Mode Select: Enabled
    Writeback Cache        : Enabled
    Access State           : Active
LU Name: 600144F0000B5DE2535E57F4C0210002
    Operational Status     : Online
    Provider Name          : sbd
    Alias                  : /dev/zvol/rdsk/rpool/iscsi/iscsi-hdd1
    View Entry Count       : 1
    Data File              : /dev/zvol/rdsk/rpool/iscsi/iscsi-hdd1
    Meta File              : not set
    Size                   : 5368709120
    Block Size             : 512
    Management URL         : not set
    Vendor ID              : SUN
    Product ID             : COMSTAR
    Serial Num             : not set
    Write Protect          : Disabled
    Write Cache Mode Select: Enabled
    Writeback Cache        : Enabled
    Access State           : Active
root@msun01:~#


ACL: 

root@msun01:~# stmfadm list-view -v -l 600144F0000B5DE2535E57F4BB4B0001
View Entry: 0
    Host group   : All
    Target Group : All
    LUN          : 0
        Lun      : 0    for iqn.1986-03.com.sun:01:00144fd4b71e.55cb6c32
        Lun      : 0    for iqn.1986-03.com.sun:01:00144fd4f6ac.55cb6016
root@msun01:~#
root@psvsparc1:~# iscsiadm list initiator-node
Initiator node name: iqn.1986-03.com.sun:01:00144fd4f6ac.55cb6016
Initiator node alias: psvsparc1
        Login Parameters (Default/Configured):
                Header Digest: NONE/-
                Data Digest: NONE/-
                Max Connections: 65535/-
        Authentication Type: NONE
        RADIUS Server: NONE
        RADIUS Access: disabled
        Tunable Parameters (Default/Configured):
                Session Login Response Time: 60/-
                Maximum Connection Retry Time: 180/-
                Login Retry Time Interval: 60/-
        Configured Sessions: 1
root@psvsparc1:~#
root@msun01:~# stmfadm create-hg psvsparc1-hg
root@msun01:~# stmfadm add-hg-member -g psvsparc1-hg iqn.1986-03.com.sun:01:00144fd4f6ac.55cb6016
root@msun01:~# stmfadm list-hg -v psvsparc1-hg
Host Group: psvsparc1-hg
        Member: iqn.1986-03.com.sun:01:00144fd4f6ac.55cb6016
root@msun01:~#
root@msun01:~# stmfadm list-target -v
Target: iqn.1986-03.com.sun:02:0454adc7-7476-4027-8f05-dde5e03bd4fd
    Operational Status     : Online
    Provider Name          : iscsit
    Alias                  : -
    Protocol               : iSCSI
    Sessions               : 2
        Initiator: iqn.1986-03.com.sun:01:00144fd4b71e.55cb6c32
            Alias: -
            Logged in since: Wed Oct  5 10:59:37 2016
        Initiator: iqn.1986-03.com.sun:01:00144fd4f6ac.55cb6016
            Alias: -
            Logged in since: Wed Oct  5 10:59:13 2016
Target: iqn.1986-03.com.sun:02:40c77c45-8a30-43e9-a570-a3a441815608
    Operational Status     : Online
    Provider Name          : iscsit
    Alias                  : -
    Protocol               : iSCSI
    Sessions               : 2
        Initiator: iqn.1986-03.com.sun:01:00144fd4f6ac.55cb6016
            Alias: -
            Logged in since: Wed Oct  5 10:52:24 2016
        Initiator: iqn.1986-03.com.sun:01:00144fd4b71e.55cb6c32
            Alias: -
            Logged in since: Wed Oct  5 10:48:34 2016
root@msun01:~#
root@msun01:~# stmfadm add-tg-member -g psvsparc1-tg iqn.1986-03.com.sun:02:0454adc7-7476-4027-8f05-

dde5e03bd4fd
stmfadm: STMF target must be offline
root@msun01:~#
root@msun01:~# stmfadm offline-target  iqn.1986-03.com.sun:02:0454adc7-7476-4027-8f05-dde5e03bd4fd
root@msun01:~# stmfadm add-tg-member -g psvsparc1-tg iqn.1986-03.com.sun:02:0454adc7-7476-4027-8f05-

dde5e03bd4fd
root@msun01:~# stmfadm online-target  iqn.1986-03.com.sun:02:0454adc7-7476-4027-8f05-dde5e03bd4fd
root@msun01:~#
root@msun01:~# stmfadm add-view -h psvsparc1-hg -t psvsparc1-tg 600144F0000B5DE2535E57F4BB4B0001
root@msun01:~# stmfadm list-view -l 600144F0000B5DE2535E57F4BB4B0001
View Entry: 0
    Host group   : All
    Target Group : All
    LUN          : 0
View Entry: 1
    Host group   : psvsparc1-hg
    Target Group : psvsparc1-tg
    LUN          : 0
root@msun01:~#
root@msun01:~# stmfadm remove-view -l 600144F0000B5DE2535E57F4BB4B0001 0
root@msun01:~# stmfadm list-view -l 600144F0000B5DE2535E57F4BB4B0001
View Entry: 1
    Host group   : psvsparc1-hg
    Target Group : psvsparc1-tg
    LUN          : 0
root@msun01:~#