Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Test tgtd iSER connection via pib (tested in Fedora 21)
if [ $EUID -ne 0 ]; then
sudo "$0" "$@"
exit $?
set -e
echo Activating pib...
systemctl start rdma
modprobe pib num_hca=1
systemctl start opensm
ip a add $IB_ADDR dev ib0
echo Activating tgtd...
modprobe ib_iser
systemctl restart tgtd
echo Creating iSER target...
dd if=/dev/zero of=/tmp/diskimg bs=1M count=256
tgtadm --lld iser -m target -o new --tid 1 --targetname $TARGET_IQN
tgtadm --lld iser -m logicalunit -o new --tid 1 --lun 1 -b /tmp/diskimg
tgtadm --lld iser --mode target --op bind --tid 1 -I ALL
echo Discovering iSER targets...
sleep 3
iscsiadm -m discovery --type sendtargets -p $IB_ADDR -I iser
echo Logging into iSER portal...
iscsiadm -m node --login -I iser -p $IB_ADDR -T $TARGET_IQN
echo Logging out of iSER portal...
iscsiadm -m node -I iser -p $IB_ADDR -T $TARGET_IQN --logout
iscsiadm -m node -I iser -p $IB_ADDR -T $TARGET_IQN -o delete
echo Deleting iSER target...
tgtadm --lld iser --mode target -o delete --tid 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment