From 60eb1434ba86d2ee72ad45aada79ddcaf7e93ddb Mon Sep 17 00:00:00 2001 From: Boaz Harrosh Date: Mon, 4 Jan 2010 17:10:50 +0200 Subject: [PATCH] open-osd: (tgt-merge-1.0.0) Remove auto configuration of /tmp osd-target Few changes at tgt * Use patch by Arne Redlich that removes the dummy RAID controller from LUN 0. At startup tgt loads without any LUN(s) * Do not use the patch that adds a default osd-target at /tmp/tgt-$(id -nu). Again tgt is initially empty. * Rebase on tgt version 1.0.0 Therefore at ./up load some osd-targets: * At top of script file define some osd backhand directories. Now easily changeable by users * optionally load all (up to 4) defined backhands as LUNs. Signed-off-by: Boaz Harrosh --- tgt | 2 +- up | 42 +++++++++++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 10 deletions(-) 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