ISCSID (targetcli) not load configuration file after reboot

Report Bugs, Issues and non- package Requests
Post Reply
Message
Author
igo
Posts: 13
Joined: Mon Dec 31, 2018 7:17 pm

ISCSID (targetcli) not load configuration file after reboot

#1 Post by igo »

I need put "targetctl restore /etc/rtslib-fb-target/saveconfig.json" in the "/etc/rc.local" to make iscsid work after reboot. The file "saveconfig.json" lost configuration if I execute command "targetctl" after reboot without restore parameter.

Code: Select all

# python -V
Python 3.5.3

Code: Select all

# ls -la /etc/init.d/ |grep -E 'iscsi|targe|rts'
-rwxr-xr-x   1 root root  1503 jun 18  2017 iscsid
-rwxr-xr-x   1 root root  2503 jun 18  2017 open-iscsi
-rwxr-xr-x   1 root root  1799 fev 28  2016 rtslib-fb-targetctl

Code: Select all

# apt install targetcli-fb

# truncate --size=215174086656 /iscsi/nvme-970evo/disk01.img

# targetcli

# create a "fileio" object connected to the new sparse file
/> /backstores/fileio create name=disk01 file_or_dev=/iscsi/nvme-970evo/disk01.img

# enable "emulated TPU" (enable TRIM / UNMAP / DISCARD)
/> /backstores/fileio/disk01 set attribute emulate_tpu=1

# create iSCSI storage object, ex: iqn.1992-01.com.example.my-desktop:storage:my-rpi3-docker
/> /iscsi create iqn.2019-01.local.labvm:storage01.iscsi:disk01

# create "LUN" assigned to the "fileio" object
/> /iscsi/iqn.2019-01.local.labvm:storage01.iscsi:disk01/tpg1/luns create /backstores/fileio/disk01

# create an ACL for my-rpi3 to connect
/> /iscsi/iqn.2019-01.local.labvm:storage01.iscsi:disk01/tpg1/acls create iqn.2019-01.local.labvm:node:disk01

# and set a CHAP username and password, for security
/> /iscsi/iqn.2019-01.local.labvm:storage01.iscsi:disk01//tpg1/acls/iqn.2019-01.local.labvm:node:disk01 set auth userid=root password=root

/> saveconfig
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/rtslib-fb-target/backup.
Configuration saved to /etc/rtslib-fb-target/saveconfig.json
/> ls
o- / ......................................................................................... [...]
  o- backstores .............................................................................. [...]
  | o- block .................................................................. [Storage Objects: 0]
  | o- fileio ................................................................. [Storage Objects: 1]
  | | o- disk01 .................... [/iscsi/nvme-970evo/disk01.img (200.4GiB) write-back activated]
  | o- pscsi .................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................ [Storage Objects: 0]
  o- iscsi ............................................................................ [Targets: 1]
  | o- iqn.2019-01.local.labvm:storage01.iscsi:disk01 .................................... [TPGs: 1]
  |   o- tpg1 ............................................................... [no-gen-acls, no-auth]
  |     o- acls .......................................................................... [ACLs: 1]
  |     | o- iqn.2019-01.local.labvm:node:disk01 .................................. [Mapped LUNs: 1]
  |     |   o- mapped_lun0 ............................................... [lun0 fileio/disk01 (rw)]
  |     o- luns .......................................................................... [LUNs: 1]
  |     | o- lun0 .................................. [fileio/disk01 (/iscsi/nvme-970evo/disk01.img)]
  |     o- portals .................................................................... [Portals: 1]
  |       o- 0.0.0.0:3260 ..................................................................... [OK]
  o- loopback ......................................................................... [Targets: 0]
  o- vhost ............................................................................ [Targets: 0]
/> exit

# apt install open-iscsi

# vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2019-01.local.labvm:node:disk01

# vim /etc/iscsi/iscsid.conf
...
node.startup = manual
#node.startup = automatic
...
node.session.auth.authmethod = CHAP
node.session.auth.username = root
node.session.auth.password = root
...


# restart iscsid so all that takes effect (especially the InitiatorName change)
# service iscsid restart

# netstat -tulpn |grep :3260
tcp        0      0 0.0.0.0:3260            0.0.0.0:*               LISTEN       - 

# iscsiadm --mode discovery --type sendtargets --portal 10.143.0.1
10.143.0.1:3260,1 iqn.2019-01.local.labvm:storage01.iscsi:disk01

# iscsiadm --mode node --targetname iqn.2019-01.local.labvm:storage01.iscsi:disk01 --portal 10.143.0.1 --login
Logging in to [iface: default, target: iqn.2019-01.local.labvm:storage01.iscsi:disk01, portal: 10.143.0.1,3260] (multiple)
Login to [iface: default, target: iqn.2019-01.local.labvm:storage01.iscsi:disk01, portal: 10.143.0.1,3260] successful.


>> List iscsi Sessions
# iscsiadm -m session -P 3
iSCSI Transport Class version 2.0-870
version 2.0-874
Target: iqn.2019-01.local.labvm:storage01.iscsi:disk01 (non-flash)
    Current Portal: 10.143.0.1:3260,1
    Persistent Portal: 10.143.0.1:3260,1
        **********
        Interface:
        **********
        Iface Name: default
        Iface Transport: tcp
        Iface Initiatorname: iqn.2019-01.local.labvm:node:disk01
        Iface IPaddress: 10.143.0.1
        Iface HWaddress: <empty>
        Iface Netdev: <empty>
        SID: 1
        iSCSI Connection State: LOGGED IN
        iSCSI Session State: LOGGED_IN
        Internal iscsid Session State: NO CHANGE
        *********
        Timeouts:
        *********
        Recovery Timeout: 120
        Target Reset Timeout: 30
        LUN Reset Timeout: 30
        Abort Timeout: 15
        *****
        CHAP:
        *****
        username: root
        password: ********
        username_in: <empty>
        password_in: ********
        ************************
        Negotiated iSCSI params:
        ************************
        HeaderDigest: None
        DataDigest: None
        MaxRecvDataSegmentLength: 262144
        MaxXmitDataSegmentLength: 262144
        FirstBurstLength: 65536
        MaxBurstLength: 262144
        ImmediateData: Yes
        InitialR2T: Yes
        MaxOutstandingR2T: 1
        ************************
        Attached SCSI devices:
        ************************
        Host Number: 2    State: running
        scsi2 Channel 00 Id 0 Lun: 0
            Attached scsi disk sdc        State: running


# lsblk --scsi
NAME HCTL       TYPE VENDOR   MODEL             REV TRAN
sdc  2:0:0:0    disk LIO-ORG  disk01           4.0  iscsi

Post Reply

Return to “Bugs and Non-Package Requests Forum”