Configuration of Linux Initiator for StorPool iSCSI¶
Note
A tool is available to check if the presently connected targets are properly configured, however it does not parse/check the /etc/iscsi/iscsid.conf
or /etc/multipath.conf
for proper settings, only suggests setting up recomended values by printing commands for fixing them for the best known performance and reliability.
To download the tool use:
wget -O /usr/local/bin/iscsi_target_checks https://vault.storpool.com/iscsi_target_checks
chmod +x /usr/local/bin/iscsi_target_checks
An example output suggesting proper settings after changing the ``/etc/iscsi/iscsid.conf`` and/or the ``/etc/multipath.conf`` files for an example target:
[root@test ~]# iscsi_target_checks iqn.2020-04.com.storpool:autotest:s23-2-iscsi-test-hdd-centos7
# Target: iqn.2020-04.com.storpool:autotest:s23-2-iscsi-test-hdd-centos7 property node.session.timeo.replacement_timeout expected -1, found 120
# command to fix to -1:
iscsiadm -m node -T iqn.2020-04.com.storpool:autotest:s23-2-iscsi-test-hdd-centos7 -p 10.1.100.204:3260,1 -o update -n node.session.timeo.replacement_timeout -v -1
# /sys/class/iscsi_session/session50/recovery_tmo value is different than expected, required off, got 120
# Please restart the iscsid service:
systemctl restart iscsid.service
Usually piping its output to sh
(or sh -x
for visibility) would be enough to fix the required values (or stop if something fails). Example:
[root@test ~]# iscsi_target_checks iqn.2020-04.com.storpool:autotest:s23-2-iscsi-test-hdd-centos7 | sh -x
+ iscsiadm -m node -T iqn.2020-04.com.storpool:autotest:s23-2-iscsi-test-hdd-centos7 -p 10.1.100.204:3260,1 -o update -n node.session.timeo.replacement_timeout -v -1
+ systemctl restart iscsid.service
Provided everything was correctly configured, there should be no subsequent output for this target even after a connection reset or a rediscover:
[root@test ~]# iscsi_target_checks iqn.2020-04.com.storpool:autotest:s23-2-iscsi-test-hdd-centos7
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 "0"
}
}
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
multipath:
node.session.timeo.replacement_timeout = 0 node.conn[0].timeo.noop_out_interval = 1 node.conn[0].timeo.noop_out_timeout = 1non-multipath:
node.session.timeo.replacement_timeout = -1 node.conn[0].timeo.noop_out_interval = 1 node.conn[0].timeo.noop_out_timeout = 1
Restart iscsid
systemctl restart iscsid
Attention
This is a crucial step, especially if the iscsiadm
tool was used for updating values for live connections/sessions, without an explicit restart some of the updated settings will not get applied to the live connection or will be reverted on an event that causes the TCP connection to re-establish. Restarting the iscsid
service would re-connect all TCP connections with the updated settings. The re-connect is not known to be service affecting.
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.