>From 2b92502e01b2eeb89f5ded7b934e0d07baf9f3fa Mon Sep 17 00:00:00 2001
From: Ronnie Sahlberg <[EMAIL PROTECTED]>
Date: Wed, 7 May 2008 17:49:12 +1000
Subject: [PATCH] Provide example on how to build DVD jukebox

Add an example on how to configure STGT to act as a DVD jukebox

Signed-off-by: Ronnie Sahlberg <[EMAIL PROTECTED]>
---
 doc/README.mmc |  175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 175 insertions(+), 0 deletions(-)

diff --git a/doc/README.mmc b/doc/README.mmc
index 6f7074d..021e4f5 100644
--- a/doc/README.mmc
+++ b/doc/README.mmc
@@ -98,3 +98,178 @@ tgtadm --tid 1 --lun 1 --op update --mode
logicalunit --name path --value /tmp/e

 # note: when we updated the device to a new bakend storage file the device
 # automatically goes online again with the new media present.
+
+
+
+
+
+
+
+
+#
+# Example 4: How to create a DVD jukebox with 8 disk trays
+#
+
+# Create a target
+tgtadm --lld iscsi --mode target --op new --tid 1 -T
iqn.2007-03:virtual-dvd:`hostname`
+
+# Create a DVD drive and give it a nice name
+# The dvd starts out without a backing store file, i.e. no disk loaded
+tgtadm --op new --mode logicalunit --tid 1 --lun 1 -Y cd
+tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1
--params 
vendor_id=STGT_DVD,product_id=DVD101,product_rev=0010,scsi_sn=STGTDVD01,removable=1
+
+
+# We need a backend store file for the media changer
+if [ ! -f $HOME/smc ]; then
+       dd if=/dev/zero of=$HOME/smc bs=1k count=1
+fi
+
+# Create the SMC device and give it a nice name
+tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 -b
$HOME/smc --device-type=changer
+tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2
--params 
vendor_id=STK,product_id=L700,product_rev=0010,scsi_sn=XYZZY_0,removable=1
+
+
+# Add a Data Transfer devices (1 drive)
+tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2
--params element_type=4,start_address=1,quantity=1
+
+# Specify that the DVD above (LUN 1) is the data transfer device we created
+tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2
--params element_type=4,address=1,tid=1,lun=1
+
+# Medium Transport Elements (robot arm / picker)
+tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2
--params element_type=1,start_address=16,quantity=1
+
+# define path to virtual media
+VTL=${HOME}/vtl
+mkdir -p ${VTL} 2>/dev/null
+tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2
--params media_home=${VTL}
+
+# Storage Elements - 8 starting at addr 1024
+tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2
--params element_type=2,start_address=1024,quantity=8
+
+# Add 'media' to slots 1 and 2 and leave the other 6 slots empty
+# slot 1
+touch ${VTL}/DISK_001
+tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2
--params element_type=2,address=1024,barcode=DISK_001,sides=1
+
+# slot 2
+touch ${VTL}/DISK_002
+tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2
--params element_type=2,address=1025,barcode=DISK_002,sides=1
+
+# Allow ALL initiators to connect to this target
+tgtadm --lld iscsi --mode target --op bind --tid 1 -I ALL
+
+# Show all our good work.
+tgtadm --lld iscsi --mode target --op show
+
+
+
+
+Now you should be able to access the devices and try it out :
+tgtadm --lld iscsi --mode target --op show
+
+Target 1: iqn.2007-03:virtual-dvd:ronnie
+    System information:
+        Driver: iscsi
+        State: ready
+    I_T nexus information:
+    LUN information:
+        LUN: 0
+            Type: controller
+            SCSI ID: deadbeaf1:0
+            SCSI SN: beaf10
+            Size: 0 MB
+            Online: Yes
+            Removable media: No
+            Backing store: No backing store
+        LUN: 1
+            Type: cd/dvd
+            SCSI ID: deadbeaf1:1
+            SCSI SN: STGTDVD0
+            Size: 0 MB
+            Online: No
+            Removable media: Yes
+            Backing store: No backing store
+        LUN: 2
+            Type: changer
+            SCSI ID: deadbeaf1:2
+            SCSI SN: XYZZY_0
+            Size: 0 MB
+            Online: Yes
+            Removable media: Yes
+            Backing store: /root/smc
+    Account information:
+    ACL information:
+        ALL
+
+
+You can use the 'mtx' command under linux to manage the jukebox (man mtx)
+mtx -f /dev/sg4 status
+
+  Storage Changer /dev/sg4:1 Drives, 8 Slots ( 0 Import/Export )
+Data Transfer Element 0:Empty
+      Storage Element 1:Full :VolumeTag=DISK_001
+      Storage Element 2:Full :VolumeTag=DISK_002
+      Storage Element 3:Empty:VolumeTag=
+      Storage Element 4:Empty:VolumeTag=
+      Storage Element 5:Empty:VolumeTag=
+      Storage Element 6:Empty:VolumeTag=
+      Storage Element 7:Empty:VolumeTag=
+      Storage Element 8:Empty:VolumeTag=
+
+Now load the disk in slot 1 :
+mtx -f /dev/sg4 load 1
+mtx -f /dev/sg4 status
+
+  Storage Changer /dev/sg4:1 Drives, 8 Slots ( 0 Import/Export )
+Data Transfer Element 0:Full (Storage Element 1 Loaded):VolumeTag =
DISK_001
+      Storage Element 1:Empty:VolumeTag=
+      Storage Element 2:Full :VolumeTag=DISK_002
+      Storage Element 3:Empty:VolumeTag=
+      Storage Element 4:Empty:VolumeTag=
+      Storage Element 5:Empty:VolumeTag=
+      Storage Element 6:Empty:VolumeTag=
+      Storage Element 7:Empty:VolumeTag=
+      Storage Element 8:Empty:VolumeTag=
+
+And if we look at the devices again we see the DVD drive is now online and has
+a disk loaded :
+tgtadm --lld iscsi --mode target --op show
+
+Target 1: iqn.2007-03:virtual-dvd:ronnie    System information:
+        Driver: iscsi
+        State: ready
+    I_T nexus information:
+        I_T nexus: 1
+            Initiator: iqn.1993-08.org.debian:ronnie
+            Connection: 0
+                IP Address: 127.0.0.1
+    LUN information:
+        LUN: 0
+            Type: controller
+            SCSI ID: deadbeaf1:0
+            SCSI SN: beaf10
+            Size: 0 MB
+            Online: Yes
+            Removable media: No
+            Backing store: No backing store
+        LUN: 1
+            Type: cd/dvd
+            SCSI ID: deadbeaf1:1
+            SCSI SN: STGTDVD0
+            Size: 0 MB
+            Online: Yes
+            Removable media: Yes
+            Backing store: /root/vtl/DISK_001
+        LUN: 2
+            Type: changer
+            SCSI ID: deadbeaf1:2
+            SCSI SN: XYZZY_0
+            Size: 0 MB
+            Online: Yes
+            Removable media: Yes
+            Backing store: /root/smc
+    Account information:
+    ACL information:
+        ALL
+
+Have fun building big DVD jukeboxes !!!
-- 
1.5.5

Attachment: 0001-Provide-example-on-how-to-build-DVD-jukebox.patch.gz
Description: GNU Zip compressed data

_______________________________________________
Stgt-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/stgt-devel

Reply via email to