[linux-target-packaging] Bug#880576: targetcli-fb: Cannot create PSCSI backend for SCSI tape drive

Herbert Nachtnebel herbert.nachtnebel at schlosserei-gogl.at
Thu Nov 9 08:24:54 UTC 2017


Hi Christian!

Thank you very much for the walk through to create the device! Indeed, 
with these instruction I could create a backend for the target. For 
completeness, one further step was missing: setting the udev_path before 
enabling the device:

echo /dev/nst0 > /sys/kernel/config/target/core/pscsi_0/tape/udev_path

But unfortunately, I currently have no time to make functional tests 
which will have to wait for today's evening. Stay tuned...

Best regards,
Herbert.


Am 2017-11-05 um 20:42 schrieb Christian Seiler:
> Control: tags -1 + confirmed upstream
>
> Hi,
>
> On 11/02/2017 02:29 PM, Herbert Nachtnebel wrote:
>> exporting a local SCSI tape drive using targetcli is not possible. The used
>> SCSI tape
>> drive is an older HP Ultrium-2 SCSI drive connected via a Adaptec 29320ALP U320
>> PCIe
>> SCSI controller to the host.  The host is a freshly set up Debian 9.2 system.
> Thanks for the detailed bug report! Unfortunately I don't have a SCSI
> tape drive with which I can test this (I only have disks and CD drives,
> which do work according to your report), so I can't reproduce this
> myself.
>
> That said, I've looked at the code, and the current pscsi interface
> in the targetcli GUI can only export block devices, but tape drives
> are actually character devices - that's why it doesn't find anything,
> because it looks for devices in /sys/block in the sysfs structure, and
> the tape drive doesn't exist there.
>
> Now I'm not currently sure whether this is just a but in targetcli
> because it assumes block devices and that tape device export would
> actually work on the kernel side, or if this also has problems with
> the kernel.
>
> Could you perhaps try to add this manually via the configfs interface?
>
> 1. Ensure that rtslib-fb-targetctl.service is started. (To make sure
>     the configfs filesystem for LIO is mounted.)
>
> 2. Run the following commands to try to create the backstore manually:
>
> # Create backstore ('tape' is just the name here, you can also call
> # it something else if you like; the other part of the path is fixed
> # though)
> mkdir -p /sys/kernel/config/target/core/pscsi_0/tape
>
> # Generate a unique WWN
> uuidgen > /sys/kernel/config/target/core/pscsi_0/tape/wwn/vpd_unit_serial
>
> # Add the device (IDs taken from your lsscsi output)
> echo scsi_host_id=2,scsi_channel_id=0,scsi_target_id=0,scsi_lun_id=0 \
>       > /sys/kernel/config/target/core/pscsi_0/tape/control
>
> # Enable the backstore
> echo 1 > /sys/kernel/config/target/core/pscsi_0/tape/enable
>
> # Check kernel logs
> # Check 'targetcli ls' output
>
> If that works and the device is added you _should_ be able to export
> it via targetcli. If that also works you should be able to use the
> tape device from an iSCSI initiator.
>
> What most likely won't work is targetctl being able to reload the
> configuration when the system reboots, so this is only temporary. [1]
>
> But if the export of the device actually does work on your system I
> could create a patch for targetctl (and possibly targetcli) that
> should fix this, and if that does work I'll ask the release team
> whether I can get that into the next point release of Stretch.
>
> Regards,
> Christian
>
> [1] Note: targetctl is the command used to restore configuration at
>      boot, targetcli is the shell to configure it.
>



More information about the Linux-target-packaging mailing list