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

- 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

OBS-URL: https://build.opensuse.org/request/show/731355
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-rtslib-fb?expand=0&rev=45
This commit is contained in:
Tomáš Chvátal 2019-09-17 06:17:54 +00:00 committed by Git OBS Bridge
parent 6f28e9a230
commit 0ca720d41b
9 changed files with 32 additions and 239 deletions

View File

@ -1,124 +0,0 @@
From 03c8c15983a21bc2b158c58140a2871bb1ed857b Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Wed, 6 Feb 2019 12:29:41 -0800
Subject: [PATCH 1/3] Handle write-only attributes.
Patch-mainline: In developer's queue
A recent kernel change (see commit 6baca7601bdee2e5) makes
the pi_prot_format protection information attribute write-only,
since it always returned 0 when being read. This commit is being
reverted, but it still brought up the prospect of write-only
attributes.
Currently, when doing a dump(), rtslib iterates through all
readable attributes to decide which ones to save as part of
our current state, but saving write-only attributes
makes no sense, since we cannot read them to capture their
value. Towards this end, enhande the _list_files() internal
method to allow filtering on whether the file is writable
as well as whether or not it is readable. Then modify
list_attributes() to allow this new parameter and modify
dump() to request only R/W attributes.
---
rtslib/node.py | 53 ++++++++++++++++++++++++++++++++++-------------------
1 file changed, 34 insertions(+), 19 deletions(-)
diff --git a/rtslib/node.py b/rtslib/node.py
index 1d77cd1b81ba..1ab7d9b8c58b 100644
--- a/rtslib/node.py
+++ b/rtslib/node.py
@@ -81,31 +81,42 @@ class CFSNode(object):
raise RTSLibNotInCFS("This %s does not exist in configFS"
% self.__class__.__name__)
- def _list_files(self, path, writable=None):
+ def _list_files(self, path, writable=None, readable=None):
'''
List files under a path depending on their owner's write permissions.
@param path: The path under which the files are expected to be. If the
path itself is not a directory, an empty list will be returned.
@type path: str
- @param writable: If None (default), returns all parameters, if True,
- returns read-write parameters, if False, returns just the read-only
- parameters.
+ @param writable: If None (default), return all files despite their
+ writability. If True, return only writable files. If False, return
+ only non-writable files.
@type writable: bool or None
- @return: List of file names filtered according to their write perms.
+ @param readable: If None (default), return all files despite their
+ readability. If True, return only readable files. If False, return
+ only non-readable files.
+ @type readable: bool or None
+ @return: List of file names filtered according to their
+ read/write perms.
'''
if not os.path.isdir(path):
return []
- if writable is None:
+ if writable is None and readable is None:
names = os.listdir(path)
- elif writable:
- names = [name for name in os.listdir(path)
- if (os.stat("%s/%s" % (path, name))[stat.ST_MODE] \
- & stat.S_IWUSR)]
else:
- names = [os.path.basename(name) for name in os.listdir(path)
- if not (os.stat("%s/%s" % (path, name))[stat.ST_MODE] \
- & stat.S_IWUSR)]
+ names = []
+ for name in os.listdir(path):
+ sres = os.stat("%s/%s" % (path, name))
+ if writable is not None:
+ if writable != ((sres[stat.ST_MODE] & stat.S_IWUSR) == \
+ stat.S_IWUSR):
+ continue
+ if readable is not None:
+ if readable != ((sres[stat.ST_MODE] & stat.S_IRUSR) == \
+ stat.S_IRUSR):
+ continue
+ names.append(name)
+
names.sort()
return names
@@ -123,17 +134,21 @@ class CFSNode(object):
path = "%s/param" % self.path
return self._list_files(path, writable)
- def list_attributes(self, writable=None):
+ def list_attributes(self, writable=None, readable=None):
'''
- @param writable: If None (default), returns all attributes, if True,
- returns read-write attributes, if False, returns just the read-only
- attributes.
+ @param writable: If None (default), return all files despite their
+ writability. If True, return only writable files. If False, return
+ only non-writable files.
@type writable: bool or None
+ @param readable: If None (default), return all files despite their
+ readability. If True, return only readable files. If False, return
+ only non-readable files.
+ @type readable: bool or None
@return: A list of existing attribute names as strings.
'''
self._check_self()
path = "%s/attrib" % self.path
- return self._list_files(path, writable)
+ return self._list_files(path, writable, readable)
def set_attribute(self, attribute, value):
'''
@@ -220,7 +235,7 @@ class CFSNode(object):
d = {}
attrs = {}
params = {}
- for item in self.list_attributes(writable=True):
+ for item in self.list_attributes(writable=True, readable=True):
try:
attrs[item] = int(self.get_attribute(item))
except ValueError:
--
2.16.4

View File

@ -1,58 +0,0 @@
From ee005008acfec749d3a9731a82fd08c6774cff49 Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Sat, 9 Feb 2019 09:36:33 -0800
Subject: [PATCH 2/3] Handle write-only parameters like attributes
Patch-mainline: In developer's queue
Commit 03c8c15983a21bc2 added handling of write-only
attributes, but we could also see write-only parameters,
since they are also from sysfs. To be safe, ensure
the parameter list returned is writable in addition
to being readable.
---
rtslib/node.py | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/rtslib/node.py b/rtslib/node.py
index 1ab7d9b8c58b..415f45d675f9 100644
--- a/rtslib/node.py
+++ b/rtslib/node.py
@@ -122,17 +122,21 @@ class CFSNode(object):
# CFSNode public stuff
- def list_parameters(self, writable=None):
+ def list_parameters(self, writable=None, readable=None):
'''
- @param writable: If None (default), returns all parameters, if True,
- returns read-write parameters, if False, returns just the read-only
- parameters.
+ @param writable: If None (default), return all parameters despite
+ their writability. If True, return only writable parameters. If
+ False, return only non-writable parameters.
@type writable: bool or None
+ @param readable: If None (default), return all parameters despite
+ their readability. If True, return only readable parameters. If
+ False, return only non-readable parameters.
+ @type readable: bool or None
@return: The list of existing RFC-3720 parameter names.
'''
self._check_self()
path = "%s/param" % self.path
- return self._list_files(path, writable)
+ return self._list_files(path, writable, readable)
def list_attributes(self, writable=None, readable=None):
'''
@@ -242,7 +246,7 @@ class CFSNode(object):
attrs[item] = self.get_attribute(item)
if attrs:
d['attributes'] = attrs
- for item in self.list_parameters(writable=True):
+ for item in self.list_parameters(writable=True, readable=True):
params[item] = self.get_parameter(item)
if params:
d['parameters'] = params
--
2.16.4

View File

@ -1,41 +0,0 @@
From 6f17cf775ca9be1aa2cf51a7efbcf4ea67e8175c Mon Sep 17 00:00:00 2001
From: Lee Duncan <lduncan@suse.com>
Date: Tue, 12 Feb 2019 10:09:58 -0800
Subject: [PATCH 3/3] Add 'readable' param to Group list_*() methods
Patch-mainline: In developer's queue
Extend use of the new 'readable' optional param
for the Node class into the Group class, so they
also return writable *and* readable entries.
Did NOT update the calls to list_attributes() and
list_parameters() in NodeACLGroup class, since
we don't need ACLs to be readable to write them
out.
---
rtslib/target.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/rtslib/target.py b/rtslib/target.py
index 814a98339a2a..92d54786501c 100644
--- a/rtslib/target.py
+++ b/rtslib/target.py
@@ -1302,11 +1302,11 @@ class Group(object):
for mem in self._mem_func(self):
setattr(mem, prop, value)
- def list_attributes(self, writable=None):
- return self._get_first_member().list_attributes(writable)
+ def list_attributes(self, writable=None, readable=None):
+ return self._get_first_member().list_attributes(writable, readable)
- def list_parameters(self, writable=None):
- return self._get_first_member().list_parameters(writable)
+ def list_parameters(self, writable=None, readable=None):
+ return self._get_first_member().list_parameters(writable, readable)
def set_attribute(self, attribute, value):
for obj in self._mem_func(self):
--
2.16.4

View File

@ -7,7 +7,7 @@
<param name="versionformat">@PARENT_TAG@</param> <param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(\d*\.\d*\.)fb(\d*)</param> <param name="versionrewrite-pattern">v(\d*\.\d*\.)fb(\d*)</param>
<param name="versionrewrite-replacement">\1\2</param> <param name="versionrewrite-replacement">\1\2</param>
<param name="revision">v2.1.fb69</param> <param name="revision">v2.1.70</param>
<param name="changesgenerate">enable</param> <param name="changesgenerate">enable</param>
</service> </service>
<service name="recompress" mode="disabled"> <service name="recompress" mode="disabled">

View File

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

View File

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

View File

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

View File

@ -1,3 +1,25 @@
-------------------------------------------------------------------
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 Mon Feb 18 17:56:57 UTC 2019 - lduncan@suse.com

View File

@ -12,24 +12,21 @@
# license that conforms to the Open Source Definition (Version 1.9) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via https://bugs.opensuse.org/
# #
%define dbdir %{_sysconfdir}/target %define dbdir %{_sysconfdir}/target
%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-rtslib-fb Name: python-rtslib-fb
Version: 2.1.69 Version: 2.1.70
Release: 0%{?dist} Release: 0%{?dist}
Summary: API for Linux kernel SCSI target (aka LIO) Summary: API for Linux kernel SCSI target (aka LIO)
License: Apache-2.0 License: Apache-2.0
Group: Development/Languages/Python Group: Development/Languages/Python
Url: https://github.com/open-iscsi/rtslib-fb.git Url: https://github.com/open-iscsi/rtslib-fb.git
Source: %{name}-%{version}.tar.xz Source: %{name}-v%{version}.tar.xz
Patch1: rbd-support.patch Patch1: rbd-support.patch
Patch2: 0001-Handle-write-only-attributes.patch
Patch3: 0002-Handle-write-only-parameters-like-attributes.patch
Patch4: 0003-Add-readable-param-to-Group-list_-methods.patch
BuildRequires: %{python_module pyudev} BuildRequires: %{python_module pyudev}
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six} BuildRequires: %{python_module six}
@ -39,7 +36,7 @@ Requires: python-pyudev
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(postun): update-alternatives Requires(postun): update-alternatives
Provides: python-rtslib = %{version}-%{release} Provides: python-rtslib = %{version}-%{release}
Obsoletes: python-rtslib Obsoletes: python-rtslib < %{version}
%if 0%{?sle_version} >= 150000 %if 0%{?sle_version} >= 150000
# explicit Provides advertising RBD support # explicit Provides advertising RBD support
Provides: python-rtslib-rbd = %{version} Provides: python-rtslib-rbd = %{version}
@ -54,14 +51,11 @@ SCSI target, present in 3.x Linux kernel versions. rtslib-fb is licensed under
the Apache 2.0 license. Contributions are welcome the Apache 2.0 license. Contributions are welcome
%prep %prep
%setup -q %setup -q -n %{name}-v%{version}
%if 0%{?sle_version} >= 150000 %if 0%{?sle_version} >= 150000
# RBD support is dependent on LIO changes present in the SLE/Leap kernel # RBD support is dependent on LIO changes present in the SLE/Leap kernel
%patch1 -p1 %patch1 -p1
%endif %endif
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build %build
%python_build %python_build