Accepting request 643046 from home:lee_duncan:branches:Base:System

- Update to version 2.1.49:
  * version 2.1.fb49
  * targetcli-fb: Add support for media change
  * fix the parameter of define_config_group_param
  * saveconfig: handle backups with block-level delete
  * saveconfig: way for block-level save with delete command
  * create: add a way to set control string
  * fix amount of backup files in backup dir
  * config: add saveconfig command to StorageObject level
  * Allow to customize a home directory
  * Fix default max_backup_files in ui_command_saveconfig
  * MappedLuns and Luns max number is not the same anymore
  * Use signed char instead of char
  * version 2.1.fb48
  * remove wrong exit code from targetcli --version
  * backup: global option to tune max no. of backup conf files
  * config: rename key 'kept_backups' as 'max_backup_files'
  * config: backup when current config is different from recent backup copy
  * config: defend on '/etc/target/backup' directory
  * Auto-detect readonly state for iblock devices
  * Read number of backup files to keep from file
  * skip refreshing user backed storage object when it is null
  * Replace dbus-python with GObject Introspection
 This replaces targetcli-fb-2.1.47.tar.xz with targetcli-fb-2.1.49.tar.xz,
 and removes the following patches:
 * Auto-detect-readonly-state-for-iblock-devices.patch
 * Use-signed-char-instead-of-char.patch
 * targetcli-only-save-old-config-if-present.patch
 and updates the SPEC file.

OBS-URL: https://build.opensuse.org/request/show/643046
OBS-URL: https://build.opensuse.org/package/show/Base:System/targetcli-fb?expand=0&rev=22
This commit is contained in:
Lee Duncan 2018-10-19 00:45:23 +00:00 committed by Git OBS Bridge
parent abfb49c9bf
commit 4a61c20fae
10 changed files with 47 additions and 155 deletions

View File

@ -1,78 +0,0 @@
From 5d1abab36be9375f46210dd19d5293cf73433681 Mon Sep 17 00:00:00 2001
From: David Disseldorp <ddiss@suse.de>
Date: Thu, 7 Dec 2017 15:25:35 +0100
Subject: [PATCH 1/4] Auto-detect readonly state for iblock devices
Configuring a read-only block device as read-write currently results in
a backstore->enable configfs I/O error, as documented in:
http://www.spinics.net/lists/target-devel/msg16310.html
This change sees targetcli check the read-only status of the underlying
block device via ioctl(BLKROGET). If a readonly= parameter isn't
provided, then the backstore will use the ioctl(BLKROGET) value as the
default.
Signed-off-by: David Disseldorp <ddiss@suse.de>
(cherry picked from commit 1a0886ecbcba6d5b2d9756ecadb3e2eaab99d29e)
---
targetcli/ui_backstore.py | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py
index 83673a0..66a21c5 100644
--- a/targetcli/ui_backstore.py
+++ b/targetcli/ui_backstore.py
@@ -19,6 +19,9 @@ under the License.
import glob
import os
+import fcntl
+import array
+import struct
import re
import stat
import dbus
@@ -516,6 +519,25 @@ class UIBlockBackstore(UIBackstore):
self.so_cls = UIBlockStorageObject
UIBackstore.__init__(self, 'block', parent)
+ def _ui_block_ro_check(self, dev):
+ BLKROGET=0x0000125E
+ try:
+ f = os.open(dev, os.O_RDONLY)
+ except (OSError, IOError):
+ raise ExecutionError("Could not open %s" % dev)
+ # ioctl returns an int. Provision a buffer for it
+ buf = array.array('c', [chr(0)] * 4)
+ try:
+ fcntl.ioctl(f, BLKROGET, buf)
+ except (OSError, IOError):
+ os.close(f)
+ return False
+
+ os.close(f)
+ if struct.unpack('I', buf)[0] == 0:
+ return False
+ return True
+
def ui_command_create(self, name, dev, readonly=None, wwn=None):
'''
Creates an Block Storage object. I{dev} is the path to the TYPE_DISK
@@ -523,7 +545,13 @@ class UIBlockBackstore(UIBackstore):
'''
self.assert_root()
- readonly = self.ui_eval_param(readonly, 'bool', False)
+ ro_string = self.ui_eval_param(readonly, 'string', None)
+ if ro_string == None:
+ # attempt to detect block device readonly state via ioctl
+ readonly = self._ui_block_ro_check(dev)
+ else:
+ readonly = self.ui_eval_param(readonly, 'bool', False)
+
wwn = self.ui_eval_param(wwn, 'string', None)
so = BlockStorageObject(name, dev, readonly=readonly, wwn=wwn)
--
2.13.6

View File

@ -1,29 +0,0 @@
From 5bfd75f66225fb4127faa2dd14d3c43af9a575a4 Mon Sep 17 00:00:00 2001
From: Taylor Jakobson <tjakobs@us.ibm.com>
Date: Thu, 1 Feb 2018 14:44:32 -0600
Subject: [PATCH 2/4] Use signed char instead of char
Python3 does not have the "character" type, use signed char instead.
(cherry picked from commit ed5ff9b9505e50b545e86dfbdd32077f0ddda0cb)
Reviewed-by: David Disseldorp <ddiss@suse.de>
---
targetcli/ui_backstore.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py
index 66a21c5..546d9d2 100644
--- a/targetcli/ui_backstore.py
+++ b/targetcli/ui_backstore.py
@@ -526,7 +526,7 @@ class UIBlockBackstore(UIBackstore):
except (OSError, IOError):
raise ExecutionError("Could not open %s" % dev)
# ioctl returns an int. Provision a buffer for it
- buf = array.array('c', [chr(0)] * 4)
+ buf = array.array('b', [0] * 4)
try:
fcntl.ioctl(f, BLKROGET, buf)
except (OSError, IOError):
--
2.13.6

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.fb47</param>
<param name="revision">v2.1.fb49</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/targetcli-fb.git</param>
<param name="changesrevision">ee32a2493eaccd9352cc596b9e3387960cca48fc</param></service></servicedata>
<param name="changesrevision">4d08771c0e6bf3cacba2ed3d3127dd10a86a7847</param></service></servicedata>

View File

@ -9,14 +9,12 @@ https://marc.info/?l=ceph-devel&m=143816209010058
[ddiss@suse.de: accept and propagate wwn parameter]
Reviewed-by: David Disseldorp <ddiss@suse.de>
---
targetcli/ui_backstore.py | 59 +++++++++++++++++++++++++++++++++++++++++++++++
targetcli/ui_backstore.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/targetcli/ui_backstore.py b/targetcli/ui_backstore.py
index 57dedb1..d576122 100644
--- a/targetcli/ui_backstore.py
+++ b/targetcli/ui_backstore.py
@@ -29,6 +29,7 @@ import dbus
@@ -29,6 +29,7 @@ import stat
from configshell_fb import ExecutionError
from rtslib_fb import BlockStorageObject, FileIOStorageObject
from rtslib_fb import PSCSIStorageObject, RDMCPStorageObject, UserBackedStorageObject
@ -24,7 +22,7 @@ index 57dedb1..d576122 100644
from rtslib_fb import ALUATargetPortGroup
from rtslib_fb import RTSLibError
from rtslib_fb import RTSRoot
@@ -269,6 +270,7 @@ class UIBackstores(UINode):
@@ -281,6 +282,7 @@ class UIBackstores(UINode):
UIRDMCPBackstore(self)
UIFileIOBackstore(self)
UIBlockBackstore(self)
@ -32,7 +30,7 @@ index 57dedb1..d576122 100644
for name, iface, prop_dict in self._user_backstores():
UIUserBackedBackstore(self, name, iface, prop_dict)
@@ -572,6 +574,48 @@ class UIBlockBackstore(UIBackstore):
@@ -589,6 +591,48 @@ class UIBlockBackstore(UIBackstore):
completions = [completions[0] + ' ']
return completions
@ -81,7 +79,7 @@ index 57dedb1..d576122 100644
class UIUserBackedBackstore(UIBackstore):
'''
@@ -739,6 +783,21 @@ class UIBlockStorageObject(UIStorageObject):
@@ -791,6 +835,21 @@ class UIBlockStorageObject(UIStorageObje
return ("%s (%s) %s%s %s" % (so.udev_path, bytes_to_human(so.size),
ro_str, wb_str, so.status), True)
@ -103,6 +101,3 @@ index 57dedb1..d576122 100644
class UIUserBackedStorageObject(UIStorageObject):
def summary(self):
--
2.13.6

View File

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

View File

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

View File

@ -1,3 +1,36 @@
-------------------------------------------------------------------
Thu Oct 18 19:50:11 UTC 2018 - opensuse-packaging@opensuse.org
- Update to version 2.1.49:
* version 2.1.fb49
* targetcli-fb: Add support for media change
* fix the parameter of define_config_group_param
* saveconfig: handle backups with block-level delete
* saveconfig: way for block-level save with delete command
* create: add a way to set control string
* fix amount of backup files in backup dir
* config: add saveconfig command to StorageObject level
* Allow to customize a home directory
* Fix default max_backup_files in ui_command_saveconfig
* MappedLuns and Luns max number is not the same anymore
* Use signed char instead of char
* version 2.1.fb48
* remove wrong exit code from targetcli --version
* backup: global option to tune max no. of backup conf files
* config: rename key 'kept_backups' as 'max_backup_files'
* config: backup when current config is different from recent backup copy
* config: defend on '/etc/target/backup' directory
* Auto-detect readonly state for iblock devices
* Read number of backup files to keep from file
* skip refreshing user backed storage object when it is null
* Replace dbus-python with GObject Introspection
This replaces targetcli-fb-2.1.47.tar.xz with targetcli-fb-2.1.49.tar.xz,
and removes the following patches:
* Auto-detect-readonly-state-for-iblock-devices.patch
* Use-signed-char-instead-of-char.patch
* targetcli-only-save-old-config-if-present.patch
and updates the SPEC file.
-------------------------------------------------------------------
Fri Apr 20 19:13:39 UTC 2018 - lduncan@suse.com

View File

@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: targetcli-fb
Version: 2.1.47
Version: 2.1.49
Release: 0
Summary: A command shell for managing the Linux LIO kernel target
License: Apache-2.0
@ -54,11 +54,8 @@ Provides: targetcli-rbd = %{version}
Obsoletes: targetcli-rbd < %{version}
%endif
%{?systemd_requires}
Patch1: Auto-detect-readonly-state-for-iblock-devices.patch
Patch2: Use-signed-char-instead-of-char.patch
Patch3: Split-out-blockdev-readonly-state-detection-helper.patch
Patch4: rbd-support.patch
Patch5: targetcli-only-save-old-config-if-present.patch
Patch1: Split-out-blockdev-readonly-state-detection-helper.patch
Patch2: rbd-support.patch
%python_subpackages
@ -84,13 +81,10 @@ python2-targetcli-fb and python3-targetcli-fb.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%if 0%{?sle_version} == 150000
# RBD support is dependent on LIO changes present in the SLE/Leap kernel
%patch4 -p1
%patch2 -p1
%endif
%patch5 -p1
%build
%python_build

View File

@ -1,23 +0,0 @@
From: Lee Duncan <lduncan@suse.com>
Date: Fri Apr 20 12:07:30 PDT 2018
Subject: [PATCH] targetcli: only save old config if present
There is no reason to copy the current configuration to the
backup directory if there is no current configuration.
Already fixed upstream, but the code is totally different
there.
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
--- a/targetcli/ui_root.py 2018-04-20 11:53:58.987907240 -0700
+++ b/targetcli/ui_root.py 2018-04-20 11:56:35.231375345 -0700
@@ -70,7 +70,7 @@ class UIRoot(UINode):
savefile = os.path.expanduser(savefile)
# Only save backups if saving to default location
- if savefile == default_save_file:
+ if (savefile == default_save_file) and os.path.exists(savefile):
backup_dir = os.path.dirname(savefile) + "/backup"
backup_name = "saveconfig-" + \
datetime.now().strftime("%Y%m%d-%H:%M:%S") + ".json"