TODO: Explain why I don't have iSCSI boot working yet, please
File as a backstore this time
targetcli > /backstores/fileio/ create file_or_dev=/var/lib/libvirt/images/sunday.img name=sunday
Creating a target is easy
> /iscsi/ create
replace the default portal:
> cd /iscsi/your_target/tpg1/ > portals/ create 172.19.12.1 3260 > portals/172.19.12.1:3260 enable_iser boolean=true
iscsiadm --mode discoverydb --type sendtargets --portal 172.20.64.11 --discover
iscsiadm --mode node --targetname iqn.2014-08.rocks.narf.southpark --portal 172.20.64.11:3260 --login
https://www.thegeekdiary.com/iscsi-connection-command-examples-cheat-sheet/
# iscsiadm -m session tcp: [1] 172.20.0.80:3260,1 iqn.2014-08.rocks.narf.southpark (non-flash)
The session number (sid) is the 1 in brackets.
If performance is poor, the initiator may have logged in using TCP instead of iSER. In my testing, to a ramdisk over IB, TCP got ~520 MiB/s, where with iSER I have gotten 3.2 GB/s.
You know you got TCP if dmesg describes your LUN like this:
[123.45678] scsi host1: iSCSI Initiator over TCP/IP [123.45678] scsi 1:0:0:0: Direct-Access LIO-ORG volume 4.0 PQ: 0 ANSI: 6
It should say iSER instead of TCP/IP. Log out of that session, then run this command. It also logs in, which makes me wonder if the initiator name argument above is necessary.
iscsi_discovery 172.20.64.13 -t iser -l
Now dmesg should show something more like this:
[123.45678] scsi host1: iSCSI Initiator over iSER [123.45678] scsi 1:0:0:0: Direct-Access LIO-ORG volume 4.0 PQ: 0 ANSI: 6
# iscsiadm -m session --sid=1 --rescan Rescanning session [sid: 1, target: iqn.2014-08.rocks.narf.southpark, portal: 172.20.0.80,3260]
Just one specific target:
iscsiadm --mode node --target <IQN> --portal 192.0.2.* --logout
–portal seems to be optional.
All of the targets:
iscsiadm --mode node --logoutall=all