Setup a new iscsi initiator
giustini is our storage, i.e. the target in iscsi terminology. The initiator, i.e. the machine that wants to access iscsi block devices, we will simply call host.
host preparations
- On the host install open-iscsi
apt-get install open-iscsi
- Then run discovery once so that giustini knows it already. Saves some copy/pasting later on:
iscsiadm -m discovery -t st -p 10.0.0.17
- You should now see two lines in the output of
iscsiadm -m node
corresponding to the two addresses that controller A has:
dijkstra:~# iscsiadm -m node 10.0.0.17:3260,1 iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a 10.0.0.18:3260,2 iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a
Meanwhile on Melee Islan^W^WGiustini
- Log into the web config interface (see dsa-passwords for details)
- Go to Manage -> General Config -> Manage Host List and give the new host a nice nickname (i.e. its name). If you did the discovery above it should already be listed in the global host list and you just need to set its name. Else you would also need to manually set the host's iqn (iscsi qualifiled name) which you can find on the host in /etc/iscsi/initiatorname.iscsi.
- Go to Manage -> General Config -> Manage CHAP to add a new entry for the new host. Pick the correct node name, and set a secret for it (N.B.: the maximum is 15, not 16 chars - the interface and documentation lies). Also setup mutual chap: As name use giustini's base iqn iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda and again pick a secret (same constraints as above).
- Go to Manage -> Volume Management -> volume menu -> add volume to add a new volume. Choose volume size and name as you wish (our policy for name appears to be "<targethost>-<mountpoint or purpose>. Leave LUN empty (i.e. NONE).
- Go to Manage -> Volume Management -> volume mapping and map the new volume to a free LUN on the new host.
Meanwhile on Melee Islan^W^WGiustini (telnet version)
- Log into the telnet config interface (see dsa-passwords for details)
- run show iscsi-hosts. You should see a iqn without a hostname attached. Compare that one to InitiatorName in /etc/iscsi/initiatorname.iscsi. If they are the same, set it like set iscsi-host host iqn.1993-08.org.debian:01:f3c2e4746681 rossini
- bad thing, you need to remember the iqn for the next step
- run show chap-records, this will list you the already configured hosts. To add a new host run something like create chap-record name iqn.1993-08.org.debian:01:f3c2e4746681 secret foobar mutual-name iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda mutual-secret 1234567890ABCDEF
- for volume management see export-iscsi
Back on the host
- edit /etc/iscsi/iscsid.conf:
- set node.session.auth.authmethod = CHAP
- set node.session.auth.username to own initiatorname (again, see /etc/iscsi/initiatorname.iscsi)
- set node.session.auth.password
- set node.session.auth.username_in = iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda
- set node.session.auth.password_in
- stop and start iscsi:
service open-iscsi stop && sleep 3 && service open-iscsi start)
- not sure if this is necessary again:
iscsiadm -m discovery -t st -p 10.0.0.17
- and just for fun, run this again.
iscsiadm -m node
The output should be the same as above:
dijkstra:~# iscsiadm -m node 10.0.0.17:3260,1 iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a 10.0.0.18:3260,2 iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a
- moment of truth. Login:
iscsiadm -m node --targetname "iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a" --login
- cat /proc/scsi/scsi, dmsg, the logs should show it having detected new block devices as sdX. You should have gotten each volume twice (once via .17 and once via .18).
- more pretty status stuff, if you care:
dijkstra:~# iscsiadm -m session -P 1 Target: iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a Current Portal: 10.0.0.17:3260,1 Persistent Portal: 10.0.0.17:3260,1 ********** Interface: ********** Iface Name: default Iface Transport: tcp Iface Initiatorname: iqn.1993-08.org.debian:01:dea714656496 Iface IPaddress: 10.0.0.218 Iface HWaddress: default Iface Netdev: default SID: 1 iSCSI Connection State: LOGGED IN iSCSI Session State: LOGGED_IN Internal iscsid Session State: NO CHANGE Current Portal: 10.0.0.18:3260,2 Persistent Portal: 10.0.0.18:3260,2 ********** Interface: ********** Iface Name: default Iface Transport: tcp Iface Initiatorname: iqn.1993-08.org.debian:01:dea714656496 Iface IPaddress: 10.0.0.218 Iface HWaddress: default Iface Netdev: default SID: 2 iSCSI Connection State: LOGGED IN iSCSI Session State: LOGGED_IN Internal iscsid Session State: NO CHANGE
- next, install and configure multipath-tools
cat > /etc/multipath.conf << EOF defaults { udev_dir /dev polling_interval 10 selector "round-robin 0" path_grouping_policy multibus getuid_callout "/lib/udev/scsi_id -g -u -s /block/%n" prio_callout /bin/true path_checker readsector0 rr_min_io 100 rr_weight priorities failback immediate no_path_retry fail user_friendly_name yes } blacklist { devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*" devnode "^hd[a-z][[0-9]*]" devnode "^vd[a-z]" devnode "^cciss!c[0-9]d[0-9]*[p[0-9]*]" device { vendor DEC.* product MSA[15]00 } } multipaths { multipath { wwid 3600c0ff000d5f6bde2d4cf4901000000 alias geo2-boot } } EOF apt-get install multipath-tools
- look at the topology
echo show topology | multipathd -k
- for the wwid thing in there create an entry in multipath.conf with a proper name, then reload multipathd
vi /etc/multipath.conf service multipath-tools reload echo show topology | multipathd -k ls -l /dev/mapper
- If you are happy with what you have, change node.startup to automatic in iscsid.conf
vi /etc/iscsi/iscsid.conf
- see if it works out of the box after a reboot.
misc
- misc commands:
iscsiadm -m node --targetname "iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a" --rescan iscsiadm -m node --targetname "iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a" --login iscsiadm -m node --targetname "iqn.1986-03.com.hp:storage.msa2012i.0834d5ecda.a" --logout