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

exit with traceback when block device dissapears from os before being removed from targetcli #180

Open
mailinglists35 opened this issue Mar 14, 2021 · 0 comments

Comments

@mailinglists35
Copy link

mailinglists35 commented Mar 14, 2021

steps to reproduce

create entry in /backstores/block

add it to a tpg

exit targetcli

in os do echo 1 > /sys/block/sdX/device/delete

return to targetcli

/> ls
Traceback (most recent call last):
  File "/usr/bin/targetcli", line 122, in <module>
    main()
  File "/usr/bin/targetcli", line 112, in main
    shell.run_interactive()
  File "/usr/lib/python3/dist-packages/configshell_fb/shell.py", line 905, in run_interactive
    self._cli_loop()
  File "/usr/lib/python3/dist-packages/configshell_fb/shell.py", line 734, in _cli_loop
    self.run_cmdline(cmdline)
  File "/usr/lib/python3/dist-packages/configshell_fb/shell.py", line 848, in run_cmdline
    self._execute_command(path, command, pparams, kparams)
  File "/usr/lib/python3/dist-packages/configshell_fb/shell.py", line 823, in _execute_command
    result = target.execute_command(command, pparams, kparams)
  File "/usr/lib/python3/dist-packages/configshell_fb/node.py", line 1406, in execute_command
    return method(*pparams, **kparams)
  File "/usr/lib/python3/dist-packages/configshell_fb/node.py", line 710, in ui_command_ls
    tree = self._render_tree(target, depth=depth)
  File "/usr/lib/python3/dist-packages/configshell_fb/node.py", line 861, in _render_tree
    + self._render_tree(children[i], margin, depth)
  File "/usr/lib/python3/dist-packages/configshell_fb/node.py", line 861, in _render_tree
    + self._render_tree(children[i], margin, depth)
  File "/usr/lib/python3/dist-packages/configshell_fb/node.py", line 861, in _render_tree
    + self._render_tree(children[i], margin, depth)
  File "/usr/lib/python3/dist-packages/configshell_fb/node.py", line 765, in _render_tree
    (description, is_healthy) = root.summary()
  File "/usr/lib/python3/dist-packages/targetcli/ui_backstore.py", line 749, in summary
    return ("%s (%s) %s%s %s" % (so.udev_path, bytes_to_human(so.size),
  File "/usr/lib/python3/dist-packages/rtslib_fb/tcm.py", line 748, in _get_size
    return get_size_for_disk_name(self._parse_info('device')) * int(self._parse_info('SectorSize'))
  File "/usr/lib/python3/dist-packages/rtslib_fb/utils.py", line 180, in get_size_for_disk_name
    return get_size(name)
  File "/usr/lib/python3/dist-packages/rtslib_fb/utils.py", line 171, in get_size
    device = pyudev.Device.from_name(_CONTEXT, 'block', name)
  File "/usr/lib/python3/dist-packages/pyudev/device/_device.py", line 414, in from_name
    return Devices.from_name(context, subsystem, sys_name)
  File "/usr/lib/python3/dist-packages/pyudev/device/_device.py", line 139, in from_name
    raise DeviceNotFoundByNameError(subsystem, sys_name)
pyudev.device._errors.DeviceNotFoundByNameError: No device 'sdc' in 'block'

you can fix if you remember the name by going again into /backstores/block and deleting
but if you don't remember the name, how do you find it to delete it if ls crashes?

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