Skip to content
Permalink
d50f88e3c6
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 44 lines (35 sloc) 1 KB
#!/bin/sh
# Path to executables, assuming source tree
TGTADM=./tgt/usr/tgtadm
OTGTD=./tgt/usr/otgtd
# must have target1
BACKSTORE1=/usr0/var/osd-tgt/tgt-0/
# Optional additional back-stores here
BACKSTORE2=/usr0/var/osd-tgt/tgt-1/
# BACKSTORE3=/usr0/var/osd-tgt/tgt-2/
# BACKSTORE4=/usr0/var/osd-tgt/tgt-3/
# $1<=BACKSTORE $2<=tid
load_target()
{
$TGTADM --lld iscsi --mode target --op new --tid $2 --targetname ${1//\//\.}$(hostname)
$TGTADM --lld iscsi --mode target \
--op bind --tid $2 --initiator-address ALL
$TGTADM --lld iscsi --mode logicalunit \
--op new --tid $2 --lun 0 --bstype=osdemu --device-type osd \
--backing-store $1
}
# First run the otgtd daemon in forgraound
# -f - forgraound
# -d - debug level
# DEBUG="-d 9"
DEBUG=""
$OTGTD $DEBUG -f &
sleep 2
# 2nd Load some targets
load_target $BACKSTORE1 1
load_target $BACKSTORE2 2
# load_target $BACKSTORE3 3
# load_target $BACKSTORE4 4
# Last print what we got, then stay in forgraound (ctrl-C to exit)
$TGTADM --lld iscsi --mode target --op show
wait