open-iscsi / rtslib-fb

Python library for configuring the Linux kernel-based multiprotocol SCSI target (LIO)
Apache License 2.0
72 stars 90 forks source link

"targetctl clear" fails with Linux 5.18-rc6 #185

Closed cvubrugier closed 2 years ago

cvubrugier commented 2 years ago

I tested LIO with Linux 5.18-rc6 and when running targetctl clear, I observed the following error:

# sudo targetctl clear
Traceback (most recent call last):
  File "/usr/bin/targetctl", line 82, in <module>
    main()
  File "/usr/bin/targetctl", line 79, in main
    funcs[sys.argv[1]](savefile)
  File "/usr/bin/targetctl", line 57, in clear
    RTSRoot().clear_existing(confirm=True)
  File "/usr/lib/python3/dist-packages/rtslib_fb/root.py", line 318, in clear_existing
    so.delete()
  File "/usr/lib/python3/dist-packages/rtslib_fb/tcm.py", line 269, in delete
    for lun in self._gen_attached_luns():
  File "/usr/lib/python3/dist-packages/rtslib_fb/tcm.py", line 215, in _gen_attached_luns
    for tpgt_dir in listdir(tpgts_base):
NotADirectoryError: [Errno 20] Not a directory: '/sys/kernel/config/target/iscsi/cpus_allowed_list'

The cpus_allowed_list attribute was added to the Linux kernel by this commit: scsi: target: Add iscsi/cpus_allowed_list in configfs before Linux v5.18-rc1.

I will provide a fix for this issue.

cvubrugier commented 2 years ago

Sorry, my bug report is invalid. The version of targetcli on Ubuntu I used is too old. The bug is already fixed upstream. See 94c7057b07cf70b73ed82adafefb73386e3fa71c