Configuration of Linux Initiator for StorPool iSCSI

1. Multipath

Install multipath:

yum -y install device-mapper-multipath

1.1. Configure multipath

Add in /etc/multipath.conf

defaults {
        prio                    "alua"
        failback                "manual"
        no_path_retry           "queue"
        queue_without_daemon    "yes"

}

devices {
    device {
        vendor                  "StorPool"
        product                 ".*"
        path_grouping_policy    multibus
        path_selector           "round-robin 0"
        features                "1 queue_if_no_path"
        fast_io_fail_tmo        "off"
    }
}

Restart multipathd:

systemctl restart mutipathd

2. iSCSI Initiator

Install iscsi initiator toools:

yum -y install iscsi-initiator-utils

Set Initiator IQN in /etc/iscsi/initiatorname.iscsi

InitiatorName=iqn.2019-01.com.storpool:s09-1

Set following values in /etc/iscsi/iscsid.conf

node.session.timeo.replacement_timeout = 0 # set to -1, if no multipath
node.conn[0].timeo.noop_out_interval = 1
node.conn[0].timeo.noop_out_timeout = 1

Restart iscsid

systemctl restart iscsid

2.1. Set block device timeout

Add a rule: /etc/udev/rules.d/99-storpool.rules

# Set the HBA timeout to 3600 seconds
ACTION=="add", SUBSYSTEMS=="scsi", ATTRS{vendor}=="StorPool", RUN+="/bin/sh -c 'echo 3600 > /sys/$DEVPATH/device/timeout'"

2.2. Discover and connect to target

iscsiadm --mode discoverydb --type sendtargets --portal ${portal_ip} --discover
iscsiadm --mode node --targetname ${target} --login

Check iscsi session:

iscsiadm -m session -P 3

2.3. Check multipath

# multipath -ll
3300000000a1b0b9c dm-2 StorPool,iSCSI DISK
size=100G features='1 queue_if_no_path' hwhandler='0' wp=rw
`-+- policy='round-robin 0' prio=50 status=active
  |- 10:0:0:0 sdp 8:240 active ready running
  `- 11:0:0:0 sdq 65:0  active ready running

Make sure the block devices are in the same group (under the same ‘policy=’ line)

2.4. Verify timeouts

# egrep -H . /sys/block/sdb/device/timeout
/sys/block/sdb/device/timeout:3600

# egrep -H . /sys/class/iscsi_session/*/device/*/iscsi_connection/*/{ping,recv}_tmo
/sys/class/iscsi_session/session5/device/connection5:0/iscsi_connection/connection5:0/ping_tmo:1
/sys/class/iscsi_session/session6/device/connection6:0/iscsi_connection/connection6:0/ping_tmo:1
/sys/class/iscsi_session/session5/device/connection5:0/iscsi_connection/connection5:0/recv_tmo:1
/sys/class/iscsi_session/session6/device/connection6:0/iscsi_connection/connection6:0/recv_tmo:1

# egrep -H . /sys/class/iscsi_session/*/recovery_tmo
/sys/class/iscsi_session/session5/recovery_tmo:0
/sys/class/iscsi_session/session6/recovery_tmo:0
# shall be 'off' if iscsi is used without multipath

3. Failover and recovery

With multipath configuration and the settings above network interface failover is about 2 seconds.

iSCSI target failover (service storpool_iscsi stop) is about 13 seconds.