Hello community,

here is the log from the commit of package python-rtslib-fb for 
openSUSE:Factory checked in at 2020-10-22 14:20:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-rtslib-fb (Old)
 and      /work/SRC/openSUSE:Factory/.python-rtslib-fb.new.3463 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-rtslib-fb"

Thu Oct 22 14:20:25 2020 rev:26 rq:842426 version:2.1.74

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-rtslib-fb/python-rtslib-fb.changes        
2020-09-01 20:06:42.876574070 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-rtslib-fb.new.3463/python-rtslib-fb.changes  
    2020-10-22 14:20:53.622675445 +0200
@@ -1,0 +2,17 @@
+Fri Oct 16 18:47:04 UTC 2020 - ldun...@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.
+
+-------------------------------------------------------------------

Old:
----
  python-rtslib-fb-v2.1.73.tar.xz

New:
----
  python-rtslib-fb-v2.1.74.tar.xz
  rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch
  rtslib-target-service-for-suse.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-rtslib-fb.spec ++++++
--- /var/tmp/diff_new_pack.OI9JqX/_old  2020-10-22 14:20:57.326678768 +0200
+++ /var/tmp/diff_new_pack.OI9JqX/_new  2020-10-22 14:20:57.330678772 +0200
@@ -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 @@
 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 @@
 # 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 -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 @@
 %dir %{dbdir}
 %dir %{dbdir}/pr
 %dir %{dbdir}/alua
+%{_unitdir}/target.service
+%{_sbindir}/rctarget
 
 %changelog

++++++ _service ++++++
--- /var/tmp/diff_new_pack.OI9JqX/_old  2020-10-22 14:20:57.362678800 +0200
+++ /var/tmp/diff_new_pack.OI9JqX/_new  2020-10-22 14:20:57.362678800 +0200
@@ -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">

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.OI9JqX/_old  2020-10-22 14:20:57.382678819 +0200
+++ /var/tmp/diff_new_pack.OI9JqX/_new  2020-10-22 14:20:57.382678819 +0200
@@ -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>
\ No newline at end of file
+          <param 
name="changesrevision">33b174f313ba4f8aec2e2a159ff337ae7ca42cb8</param></service></servicedata>
\ No newline at end of file

++++++ python-rtslib-fb-v2.1.73.tar.xz -> python-rtslib-fb-v2.1.74.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-rtslib-fb-v2.1.73/rtslib/__init__.py 
new/python-rtslib-fb-v2.1.74/rtslib/__init__.py
--- old/python-rtslib-fb-v2.1.73/rtslib/__init__.py     2020-06-24 
10:16:57.000000000 +0200
+++ new/python-rtslib-fb-v2.1.74/rtslib/__init__.py     2020-08-24 
10:05:02.000000000 +0200
@@ -36,7 +36,7 @@
 
 from .alua import ALUATargetPortGroup
 
-__version__ = '2.1.73'
+__version__ = '2.1.74'
 __author__ = "Jerome Martin <j...@risingtidesystems.com>"
 __url__ = 'http://github.com/open-iscsi/rtslib-fb'
 __description__ = 'API for Linux kernel SCSI target (aka LIO)'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-rtslib-fb-v2.1.73/rtslib/fabric.py 
new/python-rtslib-fb-v2.1.74/rtslib/fabric.py
--- old/python-rtslib-fb-v2.1.73/rtslib/fabric.py       2020-06-24 
10:16:57.000000000 +0200
+++ new/python-rtslib-fb-v2.1.74/rtslib/fabric.py       2020-08-24 
10:05:02.000000000 +0200
@@ -489,4 +489,7 @@
 
     @classmethod
     def list_registered_drivers(cls):
-        return os.listdir('/sys/module/target_core_mod/holders')
+        try:
+            return os.listdir('/sys/module/target_core_mod/holders')
+        except OSError:
+            return []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-rtslib-fb-v2.1.73/rtslib/root.py 
new/python-rtslib-fb-v2.1.74/rtslib/root.py
--- old/python-rtslib-fb-v2.1.73/rtslib/root.py 2020-06-24 10:16:57.000000000 
+0200
+++ new/python-rtslib-fb-v2.1.74/rtslib/root.py 2020-08-24 10:05:02.000000000 
+0200
@@ -476,8 +476,8 @@
         # prevent the file from being created if it exists due to a race
         try:
             fdesc = os.open(tmp_file, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 
mode)
-        finally:
-            os.umask(umask_original)
+        except OSError:
+            raise ExecutionError("Could not open %s" % tmp_file)
 
         with os.fdopen(fdesc, 'w') as f:
             f.write(json.dumps(saveconf, sort_keys=True, indent=2))
@@ -488,6 +488,7 @@
 
         # copy along with permissions
         shutil.copy(tmp_file, save_file)
+        os.umask(umask_original)
         os.remove(tmp_file)
 
     def restore_from_file(self, restore_file=None, clear_existing=True,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-rtslib-fb-v2.1.73/rtslib/utils.py 
new/python-rtslib-fb-v2.1.74/rtslib/utils.py
--- old/python-rtslib-fb-v2.1.73/rtslib/utils.py        2020-06-24 
10:16:57.000000000 +0200
+++ new/python-rtslib-fb-v2.1.74/rtslib/utils.py        2020-08-24 
10:05:02.000000000 +0200
@@ -114,7 +114,7 @@
     '''
     path = os.path.realpath(str(path))
     try:
-        file_fd = os.open(path, os.O_EXCL|os.O_NDELAY)
+        file_fd = os.open(path, os.O_EXCL|os.O_NDELAY|os.O_RDWR)
     except OSError:
         return True
     else:

++++++ rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch ++++++
>From 10f23379b2d3e2226782e2d6185bee22cc586170 Mon Sep 17 00:00:00 2001
From: Lee Duncan <ldun...@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

++++++ rtslib-target-service-for-suse.patch ++++++
--- 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

Reply via email to