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

Trying to create SCSI passthrough backstore using tape device fails when the tape drive is empty #196

Open
rkujawa opened this issue Jan 30, 2024 · 0 comments

Comments

@rkujawa
Copy link

rkujawa commented Jan 30, 2024

It's not possible to create pscsi backstore when tape drive is empty:

/backstores/pscsi> create dev=/dev/st1 name=pscsi_st1
Traceback (most recent call last):
  File "/usr/bin/targetcli", line 330, in <module>
    main()
  File "/usr/bin/targetcli", line 317, in main
    shell.run_interactive()
  File "/usr/lib/python3.12/site-packages/configshell_fb/shell.py", line 900, in run_interactive
    self._cli_loop()
  File "/usr/lib/python3.12/site-packages/configshell_fb/shell.py", line 729, in _cli_loop
    self.run_cmdline(cmdline)
  File "/usr/lib/python3.12/site-packages/configshell_fb/shell.py", line 843, in run_cmdline
    self._execute_command(path, command, pparams, kparams)
  File "/usr/lib/python3.12/site-packages/configshell_fb/shell.py", line 818, in _execute_command
    result = target.execute_command(command, pparams, kparams)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/configshell_fb/node.py", line 1406, in execute_command
    return method(*pparams, **kparams)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/targetcli/ui_backstore.py", line 369, in ui_command_create
    so = PSCSIStorageObject(name, dev)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/rtslib_fb/tcm.py", line 354, in __init__
    self._configure(dev)
  File "/usr/lib/python3.12/site-packages/rtslib_fb/tcm.py", line 391, in _configure
    if is_dev_in_use(udev_path):
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/rtslib_fb/utils.py", line 125, in is_dev_in_use
    os.close(file_fd)
OSError: [Errno 123] No medium found

This is because rtslib-fb attempts to open the device to check whether it is used. This will never work on an empty tape drive. Opening the tape device will always fail is the drive is empty (by design).

As a workaround, a tape can be inserted into the drive at the moment of creating the pscsi backend.

@rkujawa rkujawa changed the title Trying to create SCSI passthrough backend using tape device fails when the tape drive is empty Trying to create SCSI passthrough backstore using tape device fails when the tape drive is empty Jan 30, 2024
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

1 participant