Problem: automatic vtl setup using targets.conf vs script, failing on automatic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok,

here is the idea:

- I always used a script (vtl, attached) to set up a 3-drive virtual tape library, logged in using open-iscsi and he presto. That works. One of the ways of testing it is using the mtx command to view the contents of the slots and drives.

- Now I wanted to convert it to a targets.conf file, so it can be used automatically at start up of tgt. So I did created a file (targets.conf, attached).

Starting that up automatically works, login into the target also works, I can see the devices using lsscsi. Asking the status of the separate drives works also (mt -f /dev/nst0 status, etc). However, the mtx command hangs, in fact the whole tgtd daemon seems to hang as after some time the iscsid (the initiator) daemon starts to send login requests, but gets no answer. I've added the two wireshark traces as well.

Here's the actions you could find in the traces:

-> login target
mt -f /dev/nst0
mt -f /dev/nst1
mt -f /dev/nst2
mtx -f /dev/changer status
-> logout target (only when done manually, automatically this is not possible)


Attachment: automatic.pcap
Description: Binary data

Attachment: manual.pcap
Description: Binary data

# Empty targets configuration file -- please see the package
# documentation directory for an example.

include /etc/tgt/temp/*.conf

default-driver iscsi

<target iqn.2008-09.com.example:server.tape>
    allow-in-use yes
    <backing-store /root/btapes/notape1>
        lun 1
        device-type tape
        removable 1
        vendor_id "HP"
        product_id "LTO3 ULTRIUM"
        product_rev "0001"
        scsi_sn "HUM1A00001"
        scsi_id "HP LTO3 ULTRIUM"
    </backing-store>
    <backing-store /root/btapes/notape2>
        lun 2
        device-type tape
        removable 1
        vendor_id "HP"
        product_id "LTO3 ULTRIUM"
        product_rev "0001"
        scsi_sn "HUM1A00002"
        scsi_id "HP LTO3 ULTRIUM"
    </backing-store>
    <backing-store /root/btapes/notape3>
        lun 3
        device-type tape
        removable 1
        vendor_id "HP"
        product_id "LTO3 ULTRIUM"
        product_rev "0001"
        scsi_sn "HUM1A00003"
        scsi_id "HP LTO3 ULTRIUM"
    </backing-store>
    <backing-store /root/smc>
        lun 4
        device-type changer
        removable 1
        vendor_id "STK"
        product_id "L700"
        product_rev "0001"
        scsi_sn "123:456:789:000"
        # Dummy 'page 0'
        mode_page "0:0:0"
        # Page 0x02: Disconnect/Reconnect SPC-3
        mode_page "0x02:0:14:0x80:0x80:0:0xa:0:0:0:0:0:0:0:0:0:0"
        # Page 0x1a: Power Condition SPC-3
        mode_page "0x1a:0:18:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0"
        # Page 0x1c: Informational Exceptions Control SPC-3
        mode_page "0x1c:0:10:8:0:0:0:0:0:0:0:0:0"
        # Page 0x1d: Element Address Assignment SMC-3 7.3.4
        mode_page "0x1d:0:0x12:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0"
        # Page 0x1e: Transport Geometry Parameters SMC-3 7.3.5
        mode_page "0x1e:0:2:0:0"
        # Page 0x1f: Device Capabilities SMC-3 7.3.2
        # Page 0x1f/Subpage 0x41: Extended Device Capabilities SMC-3 7.3.3
        mode_page "0x1f:0:0x12:0x0f:7:0x0f:0x0f:0x0f:0x0f:0:0:0:0:0x0f:0x0f:0x0f:0x0f:0:0:0:0"
        # Type 1: Medium Transport Elements (robot arm/picker)
        params element_type=1,start_address=1,quantity=1,media_home=/root/btapes
        # Type 2: Storage Elements (tape slots)
        params element_type=2,start_address=1000,quantity=24,media_home=/root/btapes
        # Type 3: Import/Export Elements (CAP)
        params element_type=3,start_address=10,quantity=5,media_home=/root/btapes
        # Type 4: Add Data Transfer devices (drives)
        params element_type=4,start_address=500,quantity=3,media_home=/root/btapes
        params element_type=4,address=500,tid=1,lun=1
        params element_type=4,address=500,tid=1,lun=2
        params element_type=4,address=500,tid=1,lun=3
    </backing-store>
</target>
#!/bin/bash

###############################################################################
# Set up target 
###############################################################################

# Create Target ID 1..
tgtadm --lld iscsi --mode target --op new --tid 1 -T iqn.2008-09.com.example:server.tape
sleep 1

###############################################################################
# Set up tape drives
###############################################################################

tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /root/tapes/notape --device-type tape
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 --params vendor_id=HP,product_id="LTO3 ULTRIUM",product_rev=0001,scsi_sn=HUM1A00001,scsi_id="HP LTO3 ULTRIUM",removable=1
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 -b /root/tapes/notape --device-type tape
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params vendor_id=HP,product_id="LTO3 ULTRIUM",product_rev=0001,scsi_sn=HUM1A00002,scsi_id="HP LTO3 ULTRIUM",removable=1
tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 3 -b /root/tapes/notape --device-type=tape
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 3 --params vendor_id=HP,product_id="LTO3 ULTRIUM",product_rev=0001,scsi_sn=HUM1A00003,scsi_id="HP LTO3 ULTRIUM",removable=1


###############################################################################
# Set up SMC Medium Changer
###############################################################################
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 1 --lun 4 -b $HOME/smc --device-type=changer

#### Set up mode pages ####
# From smc3-06.pdf
# Page 0x02: Disconnect/Reconnect SPC-3
# Page 0x0a: Control SPC-3
# Page 0x18: Protocol Specific LUN SPC-3
# Page 0x19: Protocol Specific Port SPC-3
# Page 0x1a: Power Condition SPC-3
# Page 0x1c: Informational Exceptions Control SPC-3
# Page 0x1d: Element Address Assignment SMC-3 7.3.4
# Page 0x1e: Transport Geometry Parameters SMC-3 7.3.5
# Page 0x1f: Device Capabilities SMC-3 7.3.2
# Page 0x1f/Subpage 0x41: Extended Device Capabilities SMC-3 7.3.3

# Dummy 'page 0'
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params mode_page=0:0:0

# Disconnect/Reconnect
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params mode_page=2:0:14:0x80:0x80:0:0xa:0:0:0:0:0:0:0:0:0:0

# Power Condition
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params mode_page=0x1a:0:18:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

# Informational Exceptions Control Mode Page
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params mode_page=0x1c:0:10:8:0:0:0:0:0:0:0:0:0

# Element Address Assignment - Setup afterwards.
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params mode_page=0x1d:0:0x12:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0

# Transport Geometry Parameters
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params mode_page=0x1e:0:2:0:0

# Device Capabilities
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params mode_page=0x1f:0:0x12:0x0f:7:0x0f:0x0f:0x0f:0x0f:0:0:0:0:0x0f:0x0f:0x0f:0x0f:0:0:0:0

tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params vendor_id=STK,product_id=L700,product_rev=0001,scsi_sn="123:456:789:001",scsi_id="STK L700",removable=0

## Add Data Transfer devices (3 drives)
# Define slot address for devices.
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=4,start_address=500,quantity=3

# Now define which device at each address.
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=4,address=500,tid=1,lun=1
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=4,address=501,tid=1,lun=2
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=4,address=502,tid=1,lun=3

# Medium Transport Elements (robot arm / picker)
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=1,start_address=1,quantity=1

## Storage Elements - 24 starting at addr 1000
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,start_address=1000,quantity=24

# Add 'media' to slots
#tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,address=1000,barcode=A0000001,sides=1
#tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,address=1001,barcode=A0000002,sides=1
#tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,address=1002,barcode=A0000003,sides=1
#tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,address=1003,barcode=A0000004,sides=1
#tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,address=1004,barcode=A0000005,sides=1
#tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,address=1005,barcode=A0000006,sides=1
#tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,address=1006,barcode=A0000007,sides=1
#tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,address=1007,barcode=A0000008,sides=1
#tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=2,address=1023,barcode=CLN00001,sides=1

# Import/Export Elements - 5 starting at addr 10
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params element_type=3,start_address=10,quantity=5

# define path to virtual media
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params media_home=/root/tapes

# Dump the list of configured slots to syslog...
tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 4 --params dump=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



[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux