Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Targetcli ignores TYPE_TAPE devices for pscsi export #17

Open
dkt5 opened this issue Oct 13, 2015 · 3 comments
Open

Targetcli ignores TYPE_TAPE devices for pscsi export #17

dkt5 opened this issue Oct 13, 2015 · 3 comments

Comments

@dkt5
Copy link

dkt5 commented Oct 13, 2015

http://www.spinics.net/lists/target-devel/msg09414.html
http://article.gmane.org/gmane.linux.scsi.target.devel/3602

When attempting to add via targetcli as 'create tape0 /dev/st0' (or /dev/sg1)
"Cannot find SCSI device by path and dev parameter...."
If I specify the device scsi parameters it says "scsi device does not exist"

Adding with tcm_node it shows up as a broken storage link.

Manually creating in /sys/kernel/config/target/core, the kernel panic when
'echo 1 > enable'

Unable to include kernel backtrace.

@dkt5
Copy link
Author

dkt5 commented Oct 23, 2015

Another relevant item
http://www.spinics.net/lists/target-devel/msg03940.html

@Malvineous
Copy link

FWIW I have been able to successfully export /dev/nst0 over pscsi and I successfully wrote to the tape from another machine over the resulting iSCSI connection, so perhaps this issue is now fixed?

@jondzpike
Copy link

jondzpike commented Dec 17, 2017

(edit: this is for "python rtslib" which is what came with the package targetcli, on Ubuntu 16.04.3. I realize now this post is very old and perhaps i am looking at an old version)
Hi, I was able to make a tape drive work by applying these corrections to rtslib/utils.py.
I dont have any patch file as I only program occasionally, if you want to try it you'll have
to edit the files:

-----------PATCH 1 of 2 --------------------------------------
1. In function convert_scsi_path_to_hctl
 
OLD: 
    try:
        hctl = os.listdir("/sys/block/%s/device/scsi_device"
                          % devname)[0].split(':')
    except:
        return None
    return [int(data) for data in hctl]

NEW: 
    try:
       hctl = os.listdir("/sys/block/%s/device/scsi_device"
                             % devname)[0].split(':')
       return [int(data) for data in hctl]
    except OSError: pass

    try:
       hctl = os.listdir("/sys/class/scsi_tape/%s/device/scsi_device"
                          % devname)[0].split(':')
       return [int(data) for data in hctl]
    except OSError: pass

    return None

-----------PATCH 2 of 2 --------------------------------------
In function convert_scsi_hctl_to_path
OLD: 
    for devname in os.listdir("/sys/block"):
        path = "/dev/%s" % devname
        hctl = [host, controller, target, lun]
        if convert_scsi_path_to_hctl(path) == hctl:
            return os.path.realpath(path)
NEW:
    for devname in os.listdir("/sys/block"):
        path = "/dev/%s" % devname
        hctl = [host, controller, target, lun]
        if convert_scsi_path_to_hctl(path) == hctl:
            return os.path.realpath(path)
    try:
        for devname in os.listdir("/sys/class/scsi_tape"):
            path = "/dev/%s" % devname
            hctl = [host, controller, target, lun]
            if convert_scsi_path_to_hctl(path) == hctl:
                return os.path.realpath(path)
    except OSError: pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants