diff --git a/0001-Handle-write-only-attributes.patch b/0001-Handle-write-only-attributes.patch deleted file mode 100644 index 16c810f..0000000 --- a/0001-Handle-write-only-attributes.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 03c8c15983a21bc2b158c58140a2871bb1ed857b Mon Sep 17 00:00:00 2001 -From: Lee Duncan -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 - diff --git a/0002-Handle-write-only-parameters-like-attributes.patch b/0002-Handle-write-only-parameters-like-attributes.patch deleted file mode 100644 index 4467377..0000000 --- a/0002-Handle-write-only-parameters-like-attributes.patch +++ /dev/null @@ -1,58 +0,0 @@ -From ee005008acfec749d3a9731a82fd08c6774cff49 Mon Sep 17 00:00:00 2001 -From: Lee Duncan -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 - diff --git a/0003-Add-readable-param-to-Group-list_-methods.patch b/0003-Add-readable-param-to-Group-list_-methods.patch deleted file mode 100644 index d37791e..0000000 --- a/0003-Add-readable-param-to-Group-list_-methods.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 6f17cf775ca9be1aa2cf51a7efbcf4ea67e8175c Mon Sep 17 00:00:00 2001 -From: Lee Duncan -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 - diff --git a/_service b/_service index 96a52eb..ddb5533 100644 --- a/_service +++ b/_service @@ -7,7 +7,7 @@ @PARENT_TAG@ v(\d*\.\d*\.)fb(\d*) \1\2 - v2.1.fb69 + v2.1.70 enable diff --git a/_servicedata b/_servicedata index d6bc2e7..01f6e96 100644 --- a/_servicedata +++ b/_servicedata @@ -1,4 +1,4 @@ https://github.com/open-iscsi/rtslib-fb.git - b2ec3746fb772aa3ff8b8853965292ca7dc2d7b1 \ No newline at end of file + 2b160b754d48d5dfdfe1d41089d4e9af24ba3b29 \ No newline at end of file diff --git a/python-rtslib-fb-2.1.69.tar.xz b/python-rtslib-fb-2.1.69.tar.xz deleted file mode 100644 index 7a9c0e4..0000000 --- a/python-rtslib-fb-2.1.69.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:aeed3cd5748982ba2f684e0a67ab98e5d848e9433437739da0e8f1838c33af6a -size 41812 diff --git a/python-rtslib-fb-v2.1.70.tar.xz b/python-rtslib-fb-v2.1.70.tar.xz new file mode 100644 index 0000000..537c7ff --- /dev/null +++ b/python-rtslib-fb-v2.1.70.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24afadfbe39eb93d65b507fe4b398a91f8381f0191255fc0213dba00c31538e8 +size 42048 diff --git a/python-rtslib-fb.changes b/python-rtslib-fb.changes index 5fde839..7902ad1 100644 --- a/python-rtslib-fb.changes +++ b/python-rtslib-fb.changes @@ -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 diff --git a/python-rtslib-fb.spec b/python-rtslib-fb.spec index ab946db..b15aa09 100644 --- a/python-rtslib-fb.spec +++ b/python-rtslib-fb.spec @@ -12,24 +12,21 @@ # license that conforms to the Open Source Definition (Version 1.9) # 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 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-rtslib-fb -Version: 2.1.69 +Version: 2.1.70 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: %{name}-%{version}.tar.xz +Source: %{name}-v%{version}.tar.xz 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 setuptools} BuildRequires: %{python_module six} @@ -39,7 +36,7 @@ Requires: python-pyudev Requires(post): update-alternatives Requires(postun): update-alternatives Provides: python-rtslib = %{version}-%{release} -Obsoletes: python-rtslib +Obsoletes: python-rtslib < %{version} %if 0%{?sle_version} >= 150000 # explicit Provides advertising RBD support 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 %prep -%setup -q +%setup -q -n %{name}-v%{version} %if 0%{?sle_version} >= 150000 # RBD support is dependent on LIO changes present in the SLE/Leap kernel %patch1 -p1 %endif -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 %build %python_build