Virtual Tape Library consists of several components
- LLD – A low level driver implemented as a kernel module – mhvtl
- Target devices – Daemons vtltape(1) and vtllibrary(1) which implement SCSI target device(s) in user-space
- Utility commands mktape(1), vtlcmd(1)
- And startup scripts build_library_config(1), make_vtl_devices(1)
The kernel module is based on the scsi_debug kernel module (http://sg.danny.cz/sg/sdebug26.html). mhvtl.ko is a pseudo HBA (LLD). Note: As of 0.16, there are no default devices.
The support scripts will add Drives (SSC devices) & library (SMC) depending on the contents of /etc/mhvtl/library_contents and /etc/mhvtl/device.conf.
A char device back-end has been included with the vtl LLD driver This allows data and SCSI commands to be passed from the LLD to user-mode daemons (SCSI targets) which constently poll the driver and process any outstanding SCSI commands.
vtltape
vtltape(1) is the usermode SSC target daemon which writes/reads data to data files in the /opt/mhvtl directory (if a virtual tape has been loaded). The virtual tape files include a Medium Auxiliary Memory (MAM) data structure to store persistent data (number of tape loads, total data written/read, media type etc).
vtllibrary
vtllibrary(1) is the usermode SMC target daemon which reads its configuration from the file /etc/mhvtl/library_contents(5) at startup. The number of storage slots are built dynamically when the daemon starts. Hence changing the number of storage slots and media access slots are a matter of modifying the file contents and restarting the vtllibrary(1) daemon. All ‘library’ commands are performed on data structures in memory ONLY.
vtlcmd
A utility vtlcmd(1) is used to administrator the daemons vtltape(1) and vtllibrary.
Message queue (key 0x4d61726b) is used to pass messages between vtlcmd(1), vtllibrary(1) and vtltape(1).
When a SCSI ‘move medium’ from a storage slot to a tape drive is requested, the media location is updated in vtllibrary(1) data structures, and the barcode of the media id is passed via the message queue to the vtltape(1) daemon in question. A file open of the barcode is attempted in the /opt/mhvtl directory and if successful, the vtltape(1) daemon will now return a ASC/ASCQ 0x0/0x0 to any Test Unit Ready requests. An unload SCSI command to the tape drive will close the data file.
Media can be moved out of the VTL via the Media Access Port. Once media is logically moved into the MAP slots, the MAP entries can be cleared using the vxcmd:
# vtlcmd library empty map
The media can be ‘moved back again’ by re-starting the VTL user-space daemons:
Media can be loaded into the MAP via a :
# vtlcmd library load map
or restart the vtl
# /etc/init.d/mhvtl restart
TapeAlert
TapeAlert flags can be set using the vtlcmd(1)
e.g. vtlcmd [index] TapeAlert [flags]
Where index is the message Q offset associated with the drive (or the string ‘library’).
e.g. To set flag 14h (Clean now) the 20th bit (14h) needs to be set:
Pull out the binary to decimal calculator
1000 0000 0000 0000 0000 (20 bits) => hex => 80000
# vtlcmd 1 TapeAlert 80000
A listing of TapeAlert flags can be found at t10 home page for SSC devices Annex A.
Example
mhvtl is registered as HBA #3:
# lsscsi -g [0:0:0:0] disk MAXTOR ATLAS10K4_36SCA DFM0 /dev/sda /dev/sg0 [0:0:6:0] process PE/PV 1×3 SCSI BP 1.1 – /dev/sg1 [2:0:0:0] disk SEAGATE ST336607FC 0003 /dev/sdb /dev/sg2 [2:0:1:0] disk SEAGATE ST336607FC 0003 /dev/sdc /dev/sg3 [2:0:2:0] mediumx ATL 1500 6.0 – /dev/sg4 [2:0:2:1] tape QUANTUM SuperDLT1 2323 /dev/st0 /dev/sg5 [2:0:2:2] tape QUANTUM SuperDLT1 2323 /dev/st1 /dev/sg6 [2:0:2:3] process ATTO 310-LV 1.42 – /dev/sg7 [3:0:0:0] mediumx STK L700 vtl0 – /dev/sg8 [3:0:0:1] tape SONY SDX-900V 5400 /dev/st2 /dev/sg9 [3:0:0:2] tape SONY SDX-900V 5400 /dev/st3 /dev/sg10 [3:0:0:3] tape QUANTUM SDLT600 5400 /dev/st4 /dev/sg11 [3:0:0:4] tape QUANTUM SDLT600 5400 /dev/st5 /dev/sg12 [3:0:0:5] tape QUANTUM SDLT600 5400 /dev/st6 /dev/sg13 [3:0:0:6] tape IBM ULT3580-TD3 5400 /dev/st7 /dev/sg14 [3:0:0:7] tape IBM ULT3580-TD3 5400 /dev/st8 /dev/sg15 [3:0:0:8] tape IBM ULT3580-TD3 5400 /dev/st9 /dev/sg16