diff --git a/tgt b/tgt index 2f281d3..68c8029 160000 --- a/tgt +++ b/tgt @@ -1 +1 @@ -Subproject commit 2f281d375ab13c38cf8d726af0065a0527407a6d +Subproject commit 68c8029166f118db95ad548e116692fbbb12bd15 diff --git a/up b/up index e12b070..9c939f6 100755 --- a/up +++ b/up @@ -1,11 +1,13 @@ #!/bin/sh -# TODO: -# currently this is dependent on Pete's patch to tgt: -# [PATCH] local auto config (6b47263d) -# This dependency should be removed and this script should include -# all the necessary steps needed for a default OSD target +# must have LUN0 +BACKSTORE0=/usr0/var/osd-tgt/tgt-0/ +# Optional additional LUNes here +BACKSTORE1=/usr0/var/osd-tgt/tgt-1/ +BACKSTORE2=/usr0/var/osd-tgt/tgt-2/ +BACKSTORE3=/usr0/var/osd-tgt/tgt-3/ +TGTADM=./tgt/usr/tgtadm # -f - forgraound # -d - debug level # DEBUG="-d 9" @@ -14,9 +16,31 @@ DEBUG="" ./tgt/usr/tgtd $DEBUG -f & sleep 2 -./tgt/usr/tgtadm --lld iscsi --mode logicalunit \ - --op new --tid 1 --lun 2 --bstype=osdemu --device-type osd \ - --backing-store /tmp/tgt-bharrosh-2/ +$TGTADM --lld iscsi --mode target --op new --tid 1 --targetname $(hostname) +$TGTADM --lld iscsi --mode target \ + --op bind --tid 1 --initiator-address ALL -tgt/usr/tgtadm --lld iscsi --mode target --op show +$TGTADM --lld iscsi --mode logicalunit \ + --op new --tid 1 --lun 0 --bstype=osdemu --device-type osd \ + --backing-store $BACKSTORE0 + +if [ -n $BACKSTORE1 ]; then + $TGTADM --lld iscsi --mode logicalunit \ + --op new --tid 1 --lun 1 --bstype=osdemu --device-type osd \ + --backing-store $BACKSTORE1 +fi + +if [ -n $BACKSTORE2 ]; then + $TGTADM --lld iscsi --mode logicalunit \ + --op new --tid 1 --lun 2 --bstype=osdemu --device-type osd \ + --backing-store $BACKSTORE2 +fi + +if [ -n $BACKSTORE3 ]; then + $TGTADM --lld iscsi --mode logicalunit \ + --op new --tid 1 --lun 3 --bstype=osdemu --device-type osd \ + --backing-store $BACKSTORE3 +fi + +$TGTADM --lld iscsi --mode target --op show wait