diff --git a/_service b/_service index 74aa78b..069c1fb 100644 --- a/_service +++ b/_service @@ -7,7 +7,7 @@ @PARENT_TAG@ v(\d*\.\d*\.)fb(\d*) \1\2 - v2.1.73 + v2.1.74 enable diff --git a/_servicedata b/_servicedata index 99d2f1d..daeebe2 100644 --- a/_servicedata +++ b/_servicedata @@ -1,4 +1,4 @@ https://github.com/open-iscsi/rtslib-fb.git - 4766d9d07338778a599d7d7e2b5012ac5b03bc16 \ No newline at end of file + 33b174f313ba4f8aec2e2a159ff337ae7ca42cb8 \ No newline at end of file diff --git a/python-rtslib-fb-v2.1.73.tar.xz b/python-rtslib-fb-v2.1.73.tar.xz deleted file mode 100644 index f8da354..0000000 --- a/python-rtslib-fb-v2.1.73.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bcca674dd058af8c7a8f21ae41fb14886e5351bff63cc330644868d6f1ddf4a8 -size 42392 diff --git a/python-rtslib-fb-v2.1.74.tar.xz b/python-rtslib-fb-v2.1.74.tar.xz new file mode 100644 index 0000000..ddba12b --- /dev/null +++ b/python-rtslib-fb-v2.1.74.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a454e2b9e310fcbbab5b09df5a0b45ff2095eec02640eba75be97327a6f0b78 +size 42432 diff --git a/python-rtslib-fb.changes b/python-rtslib-fb.changes index 8c3ceaa..daa5b54 100644 --- a/python-rtslib-fb.changes +++ b/python-rtslib-fb.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +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 diff --git a/python-rtslib-fb.spec b/python-rtslib-fb.spec index 94877ca..65dec2b 100644 --- a/python-rtslib-fb.spec +++ b/python-rtslib-fb.spec @@ -19,7 +19,7 @@ %define dbdir %{_sysconfdir}/target %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-rtslib-fb -Version: 2.1.73 +Version: 2.1.74 Release: 0%{?dist} Summary: API for Linux kernel SCSI target (aka LIO) License: Apache-2.0 @@ -27,6 +27,8 @@ Group: Development/Languages/Python URL: https://github.com/open-iscsi/rtslib-fb.git Source: %{name}-v%{version}.tar.xz Patch1: rbd-support.patch +Patch2: rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch +Patch3: rtslib-target-service-for-suse.patch BuildRequires: %{python_module pyudev} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six} @@ -56,6 +58,8 @@ the Apache 2.0 license. Contributions are welcome # RBD support is dependent on LIO changes present in the SLE/Leap kernel %patch1 -p1 %endif +%patch2 -p1 +%patch3 -p1 %build %python_build @@ -73,12 +77,25 @@ 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} +ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctarget %post %python_install_alternative targetctl targetctl.8 saveconfig.json.5 +%{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} %files %{python_files} %python_alternative %{_bindir}/targetctl @@ -90,5 +107,7 @@ install -d -m755 %{buildroot}/%{dbdir}/alua %dir %{dbdir} %dir %{dbdir}/pr %dir %{dbdir}/alua +%{_unitdir}/target.service +%{_sbindir}/rctarget %changelog diff --git a/rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch b/rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch new file mode 100644 index 0000000..aa54ee1 --- /dev/null +++ b/rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch @@ -0,0 +1,65 @@ +From 10f23379b2d3e2226782e2d6185bee22cc586170 Mon Sep 17 00:00:00 2001 +From: Lee Duncan +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 + diff --git a/rtslib-target-service-for-suse.patch b/rtslib-target-service-for-suse.patch new file mode 100644 index 0000000..0bfca99 --- /dev/null +++ b/rtslib-target-service-for-suse.patch @@ -0,0 +1,18 @@ +--- 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,10 +6,13 @@ After=sys-kernel-config.mount network.ta + [Service] + Type=oneshot + RemainAfterExit=yes +-ExecStart=/usr/bin/targetctl restore ++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 + ExecStop=/usr/bin/targetctl clear + SyslogIdentifier=target + + [Install] + WantedBy=multi-user.target +- ++Alias=targetcli.service