Accepting request 842415 from home:lee_duncan:branches:devel:languages:python

- 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.

OBS-URL: https://build.opensuse.org/request/show/842415
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-rtslib-fb?expand=0&rev=55
This commit is contained in:
Lee Duncan 2020-10-19 01:23:19 +00:00 committed by Git OBS Bridge
parent 1edb5164f3
commit 5293d48576
8 changed files with 125 additions and 6 deletions

View File

@ -7,7 +7,7 @@
<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.1.73</param>
<param name="revision">v2.1.74</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">

View File

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

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bcca674dd058af8c7a8f21ae41fb14886e5351bff63cc330644868d6f1ddf4a8
size 42392

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9a454e2b9e310fcbbab5b09df5a0b45ff2095eec02640eba75be97327a6f0b78
size 42432

View File

@ -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 <moliver@suse.com>

View File

@ -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

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,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