[stgt] [PATCH 2/2] Update to tgt-core-test script
Mark Harvey
markh794 at gmail.com
Mon Aug 18 07:50:05 CEST 2008
>From e9407ce990108b0dd8daa840eeb4a4018d745a8e Mon Sep 17 00:00:00 2001
From: Mark Harvey <markh794 at gmail.com>
Date: Mon, 18 Aug 2008 15:05:55 +1000
Subject: Update scripts/tgt-core-test script to load and test new backing store
I use this script to reproduce my VTL setup for testing.
Note: I should update this to use new admin tools.
Signed-off-by: Mark Harvey <markh794 at gmail.com>
---
scripts/tgt-core-test | 48 +++++++++++++++++++++++++++++++-----------------
1 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/scripts/tgt-core-test b/scripts/tgt-core-test
index 8c58972..bef80de 100755
--- a/scripts/tgt-core-test
+++ b/scripts/tgt-core-test
@@ -2,6 +2,8 @@
# Parent directory for data files..
HOME=/d/01
+# Home directory for Virtual Tape media
+VTL=/d/01/vtl
# Start tgtd if not running..
P=`ps -ef|grep -v grep|grep tgtd|wc -l`
@@ -77,22 +79,24 @@ tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
for LUN in 2 3 4; do
- if [ ! -f $HOME/cdrom$LUN ]; then
- dd if=/dev/zero of=$HOME/cdrom$LUN bs=1M count=8
- fi
-
- # Create LUN - CD/ROM
- tgtadm --lld iscsi --mode logicalunit --op new --tid $TID --lun $LUN -b $HOME/cdrom$LUN --device-type=cd
- tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
- --params vendor_id=VirtualCD,product_id=CD101,product_rev=0010,scsi_sn=XYZZY1$LUN,removable=1
+ # Create LUN - Tape
+ tgtadm --lld iscsi --mode logicalunit --op new \
+ --tid $TID --lun $LUN \
+ --device-type ssc --bstype tape
+ tgtadm --lld iscsi --mode logicalunit --op update \
+ --tid $TID --lun $LUN \
+ --params vendor_id=QUANTUM,product_id=DLT6000,product_rev=0010,scsi_sn=XYZZY1$LUN,removable=1
# Vendor Uniq - Mode page 0..
- tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
+ tgtadm --lld iscsi --mode logicalunit --op update \
+ --tid $TID --lun $LUN \
--params mode_page=0:0:0
# ctrl mode page
- tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
+ tgtadm --lld iscsi --mode logicalunit --op update \
+ --tid $TID --lun $LUN \
--params mode_page=10:0:10:2:0:0:0:0:0:0:0:2:0
# Informational Exceptions Control Mode Page
- tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
+ tgtadm --lld iscsi --mode logicalunit --op update \
+ --tid $TID --lun $LUN \
--params mode_page=0x1c:0:10:8:0:0:0:0:0:0:0:0:0
done
@@ -100,12 +104,9 @@ done
# Set up SMC Medium Changer
###############################################################################
LUN=5
-if [ ! -f $HOME/smc ]; then
- dd if=/dev/zero of=$HOME/smc bs=1k count=1
-fi
tgtadm --lld iscsi --mode logicalunit --op new --tid $TID --lun $LUN \
- -b $HOME/smc --device-type=changer
+ --device-type=changer
#### Set up mode pages ####
# From smc3-06.pdf
@@ -166,8 +167,16 @@ tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
--params element_type=2,start_address=1024,quantity=8
# Add 'media' to slots
+BARCODE=ABC123
+if [ ! -f $VTL/$BARCODE ]; then
+ touch $VTL/$BARCODE
+fi
tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
--params element_type=2,address=1024,barcode=ABC123,sides=1
+BARCODE=ULT001L3
+if [ ! -f $VTL/$BARCODE ]; then
+ touch $VTL/$BARCODE
+fi
tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
--params element_type=2,address=1026,barcode=ULT001L3,sides=1
@@ -177,18 +186,23 @@ tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
# define path to virtual media
tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
- --params media_home=/d/01/vtl
+ --params media_home=$VTL
+
+# Set library status 'online'
+tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
+ --params online=1
# Dump the list of configured slots to syslog...
tgtadm --lld iscsi --mode logicalunit --op update --tid $TID --lun $LUN \
--params dump=1
+###### Setup of library complete ######
# Allow ALL initiators to connect to this target
tgtadm --lld iscsi --mode target --op bind --tid $TID -I ALL
-# Show all our good work.
+# Show off all our good work.
tgtadm --lld iscsi --mode target --op show
--
1.5.4.3
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
More information about the stgt
mailing list