14
0

- Update to version v2.2.2:

* Explicitly set build target wheel packages
  * Fix the program name in pyproject.toml
  * Fix and update pre-commit ruf check
  * Add PyPA publish and pre-commit check workflows
  * Add rtslib_fb import compability
  * Silently ignore OSError on close
  * fixup! Fix various issues found by ruff linter rules
  * Add ruff rules, pre-commit config
  * Convert codebase to pathlib
  * Fix various issues found by ruff linter rules
  * Refactor code to Python>=3.9 to pass pyupgrade
  * Fix issues found by ruff pep8-naming rules
  * Fix issues found by ruff pycodestyle rules
  * Use f-strings
  * Fixing issues found by ruff Pyflakes rules
  * Move to PEP-621; Drop -fb from module name
  * rtslib: explicitely import "kmod.error" and "kmod.Kmod"
  * rtslib/LUN: add some ALUA property
  Also, updated the SPEC file, and removed patch no longer needed,
  since the problem is no longer present:
  * rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch
  Added three commits, one from upstream, the others submitted there:
  * Install-targetctl-as-an-entrypoint.patch (added from upstream)
  * Remove-use-of-usr-bin-python.patch (submitted upstream)
  * Fix-issue-with-Path-open-needs-parenthesis.patch (submitted upstream)

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-rtslib-fb?expand=0&rev=81
This commit is contained in:
Lee Duncan
2025-03-24 19:48:06 +00:00
committed by Git OBS Bridge
commit 31a660aee5
13 changed files with 825 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,85 @@
From e70542fec8f78d156cee101bc8680ddabbbbd7f6 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Mon, 24 Mar 2025 11:21:59 -0700
Subject: [PATCH] Fix issue with Path(...).open: needs parenthesis
There are places where the code does this pattern:
with Path(some_path).open as f:
... (do stuff)
But that generates an error message like:
/> restoreconfig temp.json
Traceback (most recent call last):
File "/usr/bin/targetcli", line 8, in <module>
sys.exit(main())
~~~~^^
File "/usr/lib/python3.13/site-packages/targetcli/targetcli_shell.py", line 313, in main
shell.run_interactive()
~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/configshell/shell.py", line 899, in run_interactive
self._cli_loop()
~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/configshell/shell.py", line 728, in _cli_loop
self.run_cmdline(cmdline)
~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib/python3.13/site-packages/configshell/shell.py", line 842, in run_cmdline
self._execute_command(path, command, pparams, kparams)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/configshell/shell.py", line 817, in _execute_command
result = target.execute_command(command, pparams, kparams)
File "/usr/lib/python3.13/site-packages/configshell/node.py", line 1405, in execute_command
return method(*pparams, **kparams)
File "/usr/lib/python3.13/site-packages/targetcli/ui_root.py", line 207, in ui_command_restoreconfig
errors = self.rtsroot.restore_from_file(savefile, clear_existing,
target, storage_object)
File "/usr/lib/python3.13/site-packages/rtslib/root.py", line 490, in restore_from_file
with Path(restore_file).open as f:
^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'method' object does not support the context manager protocol
Adding empty parenthesis after the "open" fixes the issue.
---
rtslib/root.py | 4 ++--
scripts/convert-to-json | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/rtslib/root.py b/rtslib/root.py
index 749a80620e65..b05d380a6c50 100644
--- a/rtslib/root.py
+++ b/rtslib/root.py
@@ -190,7 +190,7 @@ class RTSRoot(CFSNode):
current = self.dump()
try:
- with Path(save_file).open as f:
+ with Path(save_file).open() as f:
saveconf = json.loads(f.read())
except OSError as e:
if e.errno == errno.ENOENT:
@@ -487,7 +487,7 @@ class RTSRoot(CFSNode):
if not restore_file:
restore_file = default_save_file
- with Path(restore_file).open as f:
+ with Path(restore_file).open() as f:
config = json.loads(f.read())
return self.restore(config, target, storage_object,
clear_existing=clear_existing,
diff --git a/scripts/convert-to-json b/scripts/convert-to-json
index daa82daf705b..7677350f3040 100755
--- a/scripts/convert-to-json
+++ b/scripts/convert-to-json
@@ -318,7 +318,7 @@ def parse(txt, cur):
elif txt[cur] == "fabric":
cur = parse_fabric(txt, cur)
-with Path("/etc/target/scsi_target.lio").open as f:
+with Path("/etc/target/scsi_target.lio").open() as f:
txt = f.read()
txt = split(txt)
cur = parse(txt, 0)
--
2.43.0

View File

@@ -0,0 +1,44 @@
From 4677e05cf54eab01bde48dcf3ae1488b6a8241b4 Mon Sep 17 00:00:00 2001
From: Alfred Wingate <parona@protonmail.com>
Date: Mon, 10 Mar 2025 09:50:53 +0200
Subject: [PATCH] Install targetctl as an entrypoint
scripts = ['scripts/targetctl'] didn't survive the transition to hatch,
readd it with required modifications.
Bug: https://bugs.gentoo.org/950964
Fixes: 9eea9a306f83b039629350dace0983f65fa9c64f
Signed-off-by: Alfred Wingate <parona@protonmail.com>
---
pyproject.toml | 5 ++++-
scripts/targetctl => rtslib/targetctl.py | 0
2 files changed, 4 insertions(+), 1 deletion(-)
rename scripts/targetctl => rtslib/targetctl.py (100%)
diff --git a/pyproject.toml b/pyproject.toml
index c07186aa007c..adebb9f104ea 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -31,6 +31,9 @@ paths = ["COPYING"]
[project.urls]
Homepage = "http://github.com/open-iscsi/rtslib-fb"
+[project.scripts]
+targetctl = "rtslib.targetctl:main"
+
[tool.hatch.version]
source = "vcs"
@@ -90,4 +93,4 @@ ignore = [
]
[tool.ruff.lint.per-file-ignores]
# Magic value used in comparison
-"scripts/targetctl" = ["PLR2004"]
+"rtslib/targetctl.py" = ["PLR2004"]
diff --git a/scripts/targetctl b/rtslib/targetctl.py
similarity index 100%
rename from scripts/targetctl
rename to rtslib/targetctl.py
--
2.43.0

View File

@@ -0,0 +1,26 @@
From 631685f400d3bd170a449503ce062a82c58d823a Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Mon, 24 Mar 2025 10:00:21 -0700
Subject: [PATCH] Remove use of /usr/bin/python
The targetctl.py script was using /usr/bin/python, even
though this package has been ported to python3.
This makes installing it on modern systems fail.
---
rtslib/targetctl.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rtslib/targetctl.py b/rtslib/targetctl.py
index e304be0d2f38..124d03f3c1fb 100755
--- a/rtslib/targetctl.py
+++ b/rtslib/targetctl.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
'''
targetctl
--
2.43.0

19
_service Normal file
View File

@@ -0,0 +1,19 @@
<services>
<service name="tar_scm" mode="disabled">
<param name="scm">git</param>
<param name="url">https://github.com/open-iscsi/rtslib-fb.git</param>
<param name="subdir"></param>
<param name="package-meta">yes</param>
<param name="filename">python-rtslib-fb</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(\d*\.\d*\.)fb(\d*)</param>
<param name="versionrewrite-replacement">\1\2</param>
<param name="revision">v2.2.2</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="file">*rtslib-fb*.tar</param>
<param name="compression">xz</param>
</service>
<service name="set_version" mode="disabled"/>
</services>

4
_servicedata Normal file
View File

@@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/open-iscsi/rtslib-fb.git</param>
<param name="changesrevision">139c7770600cd7e367ebc7504b991551c7e67bc4</param></service></servicedata>

BIN
python-rtslib-fb-v2.1.76.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
python-rtslib-fb-v2.2.2.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

391
python-rtslib-fb.changes Normal file
View File

@@ -0,0 +1,391 @@
-------------------------------------------------------------------
Sat Mar 22 15:35:05 UTC 2025 - lduncan@suse.com
- Update to version v2.2.2:
* Explicitly set build target wheel packages
* Fix the program name in pyproject.toml
* Fix and update pre-commit ruf check
* Add PyPA publish and pre-commit check workflows
* Add rtslib_fb import compability
* Silently ignore OSError on close
* fixup! Fix various issues found by ruff linter rules
* Add ruff rules, pre-commit config
* Convert codebase to pathlib
* Fix various issues found by ruff linter rules
* Refactor code to Python>=3.9 to pass pyupgrade
* Fix issues found by ruff pep8-naming rules
* Fix issues found by ruff pycodestyle rules
* Use f-strings
* Fixing issues found by ruff Pyflakes rules
* Move to PEP-621; Drop -fb from module name
* rtslib: explicitely import "kmod.error" and "kmod.Kmod"
* rtslib/LUN: add some ALUA property
Also, updated the SPEC file, and removed patch no longer needed,
since the problem is no longer present:
* rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch
Added three commits, one from upstream, the others submitted there:
* Install-targetctl-as-an-entrypoint.patch (added from upstream)
* Remove-use-of-usr-bin-python.patch (submitted upstream)
* Fix-issue-with-Path-open-needs-parenthesis.patch (submitted upstream)
-------------------------------------------------------------------
Mon Jun 17 16:09:09 UTC 2024 - Lee Duncan <lduncan@suse.com>
- Revert rtslib-refactor-to-python3.patch, which breaks targetcli
(bsc#1226388)
-------------------------------------------------------------------
Fri Jun 7 13:12:41 UTC 2024 - Markéta Machová <mmachova@suse.com>
- Add rtslib-refactor-to-python3.patch to get rid of six
-------------------------------------------------------------------
Thu May 16 15:10:26 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
- Use %autosetup macro: allows us to eliminate usage of deprecated
%patchN syntax.
-------------------------------------------------------------------
Tue Jan 9 21:43:21 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
- Clean up the SPEC file
-------------------------------------------------------------------
Tue Jan 9 11:49:34 UTC 2024 - David Disseldorp <ddiss@suse.com>
- Drop downstream-only LIO target_core_rbd support (bsc#1218634)
* rbd-support-disable_emulate_legacy_capacity.patch
* rbd-support.patch
-------------------------------------------------------------------
Thu Oct 05 09:08:31 UTC 2023 - dmueller@suse.com
- Update to version v2.1.76:
* version 2.1.76
* rtslib: remove the limit of 255 max mapped LUNs
* setup.py: match __version__ with optional trailing ".g<hash>".
* rtslib: Don't create /var/run on import
* Fix inability to create ACLs for some FC cards
-------------------------------------------------------------------
Fri Apr 21 12:33:32 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Fri May 06 16:54:21 UTC 2022 - lduncan@suse.com
- Update to version v2.1.75: (bsc#1206720)
* version 2.1.75
* rtslib: fix missing ':' after else statement
* dbroot: let the user change the dbroot directory freely.
* handle target kernel module new attribute cpus_allowed_list
* fix "This _Backstore already exists in configFS" exception
* Check whether the enable attribute exists before fread
* Filter fabric wwns by reading driver name
* Add support of efct fabric driver
* tcmu: add support for config param data_pages_per_blk
* Relax restrictions on TPG Tag range
* rtslib: Use O_RDWR for sg devices alone.
-------------------------------------------------------------------
Sun Jan 30 17:07:00 UTC 2022 - Mykola Golub <mgolub@suse.com>
- Update parameters description in rbd-support.patch
- Add rbd-support-disable_emulate_legacy_capacity.patch (bsc#1199090)
-------------------------------------------------------------------
Thu Sep 30 19:14:14 UTC 2021 - Stefan Schubert <schubi@suse.de>
- Use libalternatives instead of update-alternatives.
-------------------------------------------------------------------
Sat Nov 7 18:05:32 UTC 2020 - Lee Duncan <lduncan@suse.com>
- Fixed issue in SPEC file w/r/t package split with common.
Now, packages python3-rtslib-fb and python-rtslib-fb-common
are built, and the former depends on the latter. The common
package has the non-python parts (documentation, etc),
and the python3-* part the python parts.
-------------------------------------------------------------------
Fri Oct 23 18:20:23 UTC 2020 - Lee Duncan <lduncan@suse.com>
- Split package into "common" part, python-rtslib-fb-common, which
is python-verserion-agnostic, and either python2-rtslib-comon-fb
or python3-rtslib-fb. This maens common files, like man pages,
don't have to be duplicated.
-------------------------------------------------------------------
Fri Oct 16 18:47:04 UTC 2020 - lduncan@suse.com
- Update to version v2.1.74:
* version 2.1.74
* rtslib: safely call shutil.copy()
* Fix fail when target_core_mod doesn't exists
* Fix EPERM errors with scsi_generic devices
Also, add this commit submitted upstream:
* rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch
And this commit for SUSE:
* rtslib-target-service-for-suse.patch
Lastly, this package now installs systemd unit file target.service,
which will replace eventually targetcli.service (from the
targetcli-fb package), since this matches how upstream works.
This also meant updating the SPEC file.
-------------------------------------------------------------------
Thu Aug 27 02:10:59 UTC 2020 - Matthew Oliver <moliver@suse.com>
- Updated the rbd-support.patch (bsc#1175808):
* Fixed the signiture of the RBDStorageObject to match changes made
to parent StorageObject class.
-------------------------------------------------------------------
Tue Jun 30 17:49:04 UTC 2020 - lduncan@suse.com
- Update to version v2.1.73 (bsc#1173257 CVE-2020-14019):
* version 2.1.73
* save_to_file: fix fd open mode
* saveconfig: copy temp configfile with permissions
* saveconfig: open the temp configfile with modes set
* Fix "is not" with a literal SyntaxWarning
* Fix an incorrect config path in two comments
* version 2.1.72
* Do not change dbroot after drivers have been registered
* Remove '_if_needed' from RTSRoot._set_dbroot()'s name
Replacing old tarball with python-rtslib-fb-v2.1.73.tar.xz
-------------------------------------------------------------------
Tue Mar 03 15:46:53 UTC 2020 - lduncan@suse.com
- Update to version v2.1.71 (jre#SLE-7751):
* version 2.1.71
* restoreconfig: fix skipping of targets [re]loading
Replacing python-rtslib-fb-v2.1.70.tar.xz with python-rtslib-fb-v2.1.71.tar.xz
-------------------------------------------------------------------
Mon Sep 16 18:14:18 UTC 2019 - lduncan@suse.com
- Update to version v2.1.70:
* version 2.1.70
* restoreconfig: add ability to restore/reload single target or storage_object
* rtslib: fix __version__
* saveconfig: add hw_block_size support in control string
* remove extra semicolons in _get_saveconf
* Add 'readable' param to Group list_*() methods
* Handle write-only parameters like attributes
* save_to_file() function breaks symbolic link when saving configuration
* Handle write-only attributes.
* Allow bs_cache to be bypassed
* report the correct size for partitions
* restoreconfig: support restore when list is non-empty
Replacing python-rtslib-fb-2.1.69.tar.xz with python-rtslib-fb-v2.1.70.tar.xz,
and removing patches:
* 0001-Handle-write-only-attributes.patch
* 0002-Handle-write-only-parameters-like-attributes.patch
* 0003-Add-readable-param-to-Group-list_-methods.patch
-------------------------------------------------------------------
Mon Feb 18 17:56:57 UTC 2019 - lduncan@suse.com
- Added 3 patches subbmitted and accepted upstream, to deal with
possibly-write-only sysfs attributes (bsc#1123933), adding:
* 0001-Handle-write-only-attributes.patch
* 0002-Handle-write-only-parameters-like-attributes.patch
* 0003-Add-readable-param-to-Group-list_-methods.patch
-------------------------------------------------------------------
Fri Dec 7 09:29:54 UTC 2018 - ddiss@suse.com
- Enable RBD support for SLE/Leap 15+ (bsc#1118516)
-------------------------------------------------------------------
Tue Dec 4 12:54:00 UTC 2018 - Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
-------------------------------------------------------------------
Thu Oct 18 23:27:42 UTC 2018 - opensuse-packaging@opensuse.org
- Update to version 2.1.69:
* version 2.1.fb69
* fix compiler warning
* version 2.1.fb68
* Fix typo
* - remove underscore in hostname
* tcm: allow to enable asynchronous I/O for file backing stores
* saveconfig: way for block-level save with delete command
* saveconfig: fix missing import
* saveconfig: handle no attr exception in _parse_info()
* saveconfig: fix failure in absence of save file
* saveconfig: dump control string containing control=value tuples
* restoreconfig: fix alua tpg config setup
* tcmu: add control constructor arg
* save_to_file: support saveconfig at storage object level
* Allow creating more than 256 LUNs per target
* Ship a systemd service file
Which replaces python-rtslib-fb-2.1.67.tar.xz with
python-rtslib-fb-2.1.69.tar.xz, and updates the SPEC file as well.
-------------------------------------------------------------------
Tue Apr 10 16:03:33 UTC 2018 - ddiss@suse.com
- Merge RBD support from non-fb version (bsc#1079329)
+ rbd-support.patch (SLE/Leap only, due to LIO kernel dependency)
+ Add explicit Provides for "python-rtslib-rbd"
-------------------------------------------------------------------
Tue Apr 10 12:41:16 UTC 2018 - ddiss@suse.com
- Automatically generate version string from upstream tag
+ Retain current fb-removed version format used
+ Rename rtslib-fb-2.1.fb67.tar.xz to python-rtslib-fb-2.1.67.tar.xz and
cleanup hardcoded duplicate name/version values in spec
-------------------------------------------------------------------
Mon Apr 09 21:41:01 UTC 2018 - lduncan@suse.com
- Update to version 2.1.fb67:
* Add missing dependency on six in setup.py
* Display a more meaningful error when targetcli cannot change "dbroot"
* Raise an error about failing to change the dbroot value only if the directory does not exist
* More compatibility syntax for legacy distros
* Remove hba-only directories in clear_existing()
* Correct name for Xen pvscsi
* version 2.1.fb65
* Fix unqualified reference to pyudev.Device
* version 2.1.fb66
* create: remove stale hba-only dir
* version 2.1.fb67
- This replaced rtslib-fb-2.1.fb64.tar.xz with
rtslib-fb-2.1.fb67.tar.xz, and it also removed
the patch correct-name-for-xen-pvscsi.patch,
since it is already in the updated tarball
-------------------------------------------------------------------
Sun Feb 25 08:09:45 UTC 2018 - olaf@aepfle.de
- Fix upgrade path by provide/obsolete python-rtslib (bsc#1082693)
-------------------------------------------------------------------
Wed Jan 24 18:43:43 UTC 2018 - lduncan@suse.com
- Fix incorrect naming for XEN (bsc#1076455), adding patch:
* correct-name-for-xen-pvscsi.patch
-------------------------------------------------------------------
Tue Jan 9 14:37:15 UTC 2018 - tchvatal@suse.com
- Fix the conflict to the rtslib properly
-------------------------------------------------------------------
Wed Jan 3 16:13:57 UTC 2018 - tchvatal@suse.com
- Drop the epydoc dependency/documentation generating from the package
to allow building in py3 only enviroment
-------------------------------------------------------------------
Sun Dec 10 21:14:08 UTC 2017 - lduncan@suse.com
- Converting RPM SPEC file to singlespec format (bsc#1045332),
updating SPEC file only.
- ran 'spec-cleaner' on SPEC file to clean it up.
- Converted from manually-added rtslib-fb-2.1.fb64.tar.gz to
tar_scm service-retrieved rtslib-fb-2.1.fb64.tar.xz
-------------------------------------------------------------------
Thu Aug 17 08:03:10 UTC 2017 - lszhu@suse.com
- Update to version 2.1.fb64
*Improve ALUA and TCMU support, as well as moving the default
directory for APTPL files from /var/target to /etc/target
for better FHS compliance.
*Remove patch Switch-target-driver-DB-root-dir-to-etc-target.patch
from the spec file because upstream already has this change.
-------------------------------------------------------------------
Thu Jun 8 21:37:20 UTC 2017 - lduncan@suse.com
- Enable Persistent Reservations (bsc#1042944):
* Add patch Switch-target-driver-DB-root-dir-to-etc-target.patch
* Add /etc/target/pr and /etc/target/alua to SPEC file
-------------------------------------------------------------------
Thu Apr 13 07:11:02 UTC 2017 - hare@suse.com
- Update to version 2.1.63 (bsc#1032833):
* Get/Set LUN's ALUA group
* Add ALUA restore support
* Delete ALUA groups with its storage object
* version 2.1.fb62
* Do not set alua_tg_pt_gp if not supported
* Add ability to invalidate caches
* Add ALUA supported method
* Don't raise exception when getting/setting a LUNs ALUA group
* update to 2.1.fb63
-------------------------------------------------------------------
Fri Jun 24 23:12:29 UTC 2016 - lduncan@suse.com
- Updated spec file: Removed Provides/Obsoletes for python-rtslib,
and added Conflicts for same (bsc#986475)
-------------------------------------------------------------------
Tue Jun 14 17:12:34 UTC 2016 - lduncan@suse.com
- Fixing build issue: removed 'noarch' from main package
-------------------------------------------------------------------
Tue Jun 14 17:12:33 UTC 2016 - lduncan@suse.com
- Updated SPEC file:
* added Requires for pyudev (bsc#984563)
* removed BuildRequires of pyudev for doc sub-package
-------------------------------------------------------------------
Wed Apr 20 16:17:30 UTC 2016 - lduncan@suse.com
- Update to version 2.1.fb60
* no changelog available, but git log shows 59 changes,
some trivial
-------------------------------------------------------------------
Tue May 12 14:58:13 UTC 2015 - benoit.monin@gmx.fr
- update to version 2.1.51:
* no changelog available
-------------------------------------------------------------------
Wed Sep 3 12:01:09 UTC 2014 - dmueller@suse.com
- update to 2.1.49:
* Improve error message when NetworkPortal restore fails
* Python 3.x porting fixes
* targetctl: A missing restore file is not an error
* Add a message if no configfile is found
* Add StorageObjectFactory
* Convert all exceptions in set_parameter/attribute to RTSLibError
* Change set_parameters/attributes to take an err_func
* Fix missing err_func parameter to set_attributes
* '!' allowed character in block and partition names
* Don't add to cache if cfs create fails
* Don't lower-case return values from _parse_info functions
-------------------------------------------------------------------
Tue Jan 14 14:57:28 UTC 2014 - speilicke@suse.com
- Conflict with python-rtslib
-------------------------------------------------------------------
Mon Jan 13 13:25:15 UTC 2014 - dmueller@suse.com
- update to 2.1.43:
* various bugfixes
-------------------------------------------------------------------
Mon Oct 28 12:21:13 UTC 2013 - dmueller@suse.com
- Initial package (2.1.40)

137
python-rtslib-fb.spec Normal file
View File

@@ -0,0 +1,137 @@
#
# spec file for package python-rtslib-fb
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define dbdir %{_sysconfdir}/target
%define oldpython python
%define cpkg %{oldpython}-rtslib-fb-common
%{?sle15_python_module_pythons}
Name: python-rtslib-fb
Version: 2.2.2
Release: 0%{?dist}
Summary: API for Linux kernel SCSI target (aka LIO)
License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/open-iscsi/rtslib-fb.git
Source: python-rtslib-fb-v%{version}.tar.xz
Patch1: rtslib-target-service-for-suse.patch
Patch2: Install-targetctl-as-an-entrypoint.patch
Patch3: Remove-use-of-usr-bin-python.patch
Patch4: Fix-issue-with-Path-open-needs-parenthesis.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module hatch_vcs}
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pyudev}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: git
BuildRequires: python-rpm-macros >= 20210929
BuildRequires: pkgconfig(systemd)
Requires: %{cpkg}
Requires: python-pyudev
Provides: python-rtslib = %{version}-%{release}
Obsoletes: python-rtslib < %{version}
BuildArch: noarch
Requires(post): update-alternatives
Requires(postun): update-alternatives
%python_subpackages
%description
rtslib-fb is an object-based Python library for configuring the LIO generic
SCSI target, present in 3.x Linux kernel versions. rtslib-fb is licensed under
the Apache 2.0 license. Contributions are welcome
%package -n %{cpkg}
Summary: Common python-rtslib-fb subpackage for all Python 3 versions
Group: Development/Languages/Python
Obsoletes: %{name} < %{version}-%{release}
%description -n %{cpkg}
python-rtslib-fb-common is the invariant base package needed by all
version of python3*-rtslib-fb.
%prep
%autosetup -p1 -n python-rtslib-fb-v%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_clone -a %{buildroot}/%{_bindir}/targetctl
install -d -m755 %{buildroot}%{_mandir}/man5
install -m644 doc/saveconfig.json.5 %{buildroot}%{_mandir}/man5
install -d -m755 %{buildroot}%{_mandir}/man8
install -m644 doc/targetctl.8 %{buildroot}%{_mandir}/man8
install -d -m755 %{buildroot}/%{dbdir}
install -d -m755 %{buildroot}/%{dbdir}/pr
install -d -m755 %{buildroot}/%{dbdir}/alua
mkdir -p %{buildroot}/%{_unitdir}/
install -m644 systemd/target.service %{buildroot}/%{_unitdir}
install -d -m755 %{buildroot}%{_sbindir}
%fdupes %{buildroot}
ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctarget
%post
%python_install_alternative targetctl
%{service_add_post target.service}
%postun
%python_uninstall_alternative targetctl
%{service_del_postun target.service}
%pre
%{service_add_pre target.service}
%preun
%{stop_on_removal target}
%{service_del_preun target.service}
%post -n %{cpkg}
%{service_add_post target.service}
%postun -n %{cpkg}
%{service_del_postun target.service}
%pre -n %{cpkg}
%{service_add_pre target.service}
%preun -n %{cpkg}
%{service_del_preun target.service}
%files %{python_files}
%python_alternative %{_bindir}/targetctl
%{python_sitelib}/rtslib*
%pycache_only %{python_sitelib}/__pycache__
%files -n %{cpkg}
%license COPYING
%doc README.md
%dir %{dbdir}
%dir %{dbdir}/pr
%dir %{dbdir}/alua
%{_unitdir}/target.service
%{_sbindir}/rctarget
%{_mandir}/man5/saveconfig.json.5%{?ext_man}
%{_mandir}/man8/targetctl.8%{?ext_man}
%changelog

View File

@@ -0,0 +1,65 @@
From 10f23379b2d3e2226782e2d6185bee22cc586170 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Thu, 15 Oct 2020 14:21:20 -0700
Subject: [PATCH] Fix handling of sysfs RW attrs that are actually RO
Kernel commit 356ba2a8bc8d ("scsi: target: tcmu: Make
gr_support and alua_support attributes writable"), made the
alua_support and pgr_support sysfs attributes writable
so that individual target drivers could change them.
This means that the filesystem attributes might saw
read-write, but the attributes can in fact be read-only.
When a user tries to write to them, in this case,
they EINVAL.
This causes rtslib to throw error messages when one does
a "targetctl restore" like these:
> Storage Object fileio/file01: Cannot set attribute alua_support: [Errno 22] Invalid argument, skipped
> Storage Object fileio/file01: Cannot set attribute pgr_support: [Errno 22] Invalid argument, skipped
While these messages are benign, they will cause confusion, since
(1) there's nothing wrong, and (2) they didn't occur before above-
mentioned kernel commit.
This fix tells rtslib to ignore errno 22 for these two attributes.
---
rtslib/node.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/rtslib/node.py b/rtslib/node.py
index 415f45d675f9..ed08030002bb 100644
--- a/rtslib/node.py
+++ b/rtslib/node.py
@@ -20,6 +20,7 @@ under the License.
import os
import stat
+import errno
from .utils import fread, fwrite, RTSLibError, RTSLibNotInCFS
@@ -28,6 +29,10 @@ class CFSNode(object):
# Where is the configfs base LIO directory ?
configfs_dir = '/sys/kernel/config/target'
+ # these two attributes can have file permissions of
+ # read-write but be read-only
+ may_be_ro_attrs = ['alua_support', 'pgr_support']
+
# CFSNode private stuff
def __init__(self):
@@ -172,7 +177,8 @@ class CFSNode(object):
try:
fwrite(path, "%s" % str(value))
except Exception as e:
- raise RTSLibError("Cannot set attribute %s: %s" % (attribute, e))
+ if attribute not in self.may_be_ro_attrs or e.errno != errno.EINVAL:
+ raise RTSLibError("Cannot set attribute %s: %s" % (attribute, e))
def get_attribute(self, attribute):
'''
--
2.26.2

View File

@@ -0,0 +1,24 @@
From: Lee Duncan <lduncan@suse.com>
Date: Sat Mar 22 10:52:22 AM PDT 2025
Subject: [PATCH] blah
Blah
---
--- a/systemd/target.service 2019-01-31 11:11:28.517558290 -0800
+++ b/systemd/target.service 2020-10-16 09:34:28.888091013 -0700
@@ -6,9 +6,12 @@ After=sys-kernel-config.mount network.ta
[Service]
Type=oneshot
RemainAfterExit=yes
-ExecStart=/usr/bin/targetctl restore
-ExecStop=/usr/bin/targetctl clear
+Environment=CONFIG_FILE=/etc/target/saveconfig.json
+EnvironmentFile=-/etc/sysconfig/target
+ExecStart=/usr/bin/targetctl restore $CONFIG_FILE
+ExecStop=/usr/bin/targetctl save $CONFIG_FILE
SyslogIdentifier=target
[Install]
WantedBy=multi-user.target
+Alias=targetcli.service