Accepting request 1137851 from devel:languages:python
- Clean up the SPEC file - Drop downstream-only LIO target_core_rbd support (bsc#1218634) * rbd-support-disable_emulate_legacy_capacity.patch * rbd-support.patch OBS-URL: https://build.opensuse.org/request/show/1137851 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-rtslib-fb?expand=0&rev=34
This commit is contained in:
commit
2152d1b042
@ -1,3 +1,15 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jan 9 21:43:21 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
|
||||||
|
|
||||||
|
- Clean up the SPEC file
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jan 9 11:49:34 UTC 2024 - David Disseldorp <ddiss@suse.com>
|
||||||
|
|
||||||
|
- Drop downstream-only LIO target_core_rbd support (bsc#1218634)
|
||||||
|
* rbd-support-disable_emulate_legacy_capacity.patch
|
||||||
|
* rbd-support.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Oct 05 09:08:31 UTC 2023 - dmueller@suse.com
|
Thu Oct 05 09:08:31 UTC 2023 - dmueller@suse.com
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-rtslib-fb
|
# spec file for package python-rtslib-fb
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -16,14 +16,14 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%define dbdir %{_sysconfdir}/target
|
||||||
|
%define oldpython python
|
||||||
|
%define cpkg %{oldpython}-rtslib-fb-common
|
||||||
%if 0%{?suse_version} > 1500
|
%if 0%{?suse_version} > 1500
|
||||||
%bcond_without libalternatives
|
%bcond_without libalternatives
|
||||||
%else
|
%else
|
||||||
%bcond_with libalternatives
|
%bcond_with libalternatives
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%define dbdir %{_sysconfdir}/target
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
|
||||||
%{?sle15_python_module_pythons}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-rtslib-fb
|
Name: python-rtslib-fb
|
||||||
Version: 2.1.76
|
Version: 2.1.76
|
||||||
@ -33,35 +33,28 @@ 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: python-rtslib-fb-v%{version}.tar.xz
|
Source: python-rtslib-fb-v%{version}.tar.xz
|
||||||
Patch1: rbd-support.patch
|
|
||||||
Patch2: rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch
|
Patch2: rtslib-Fix-handling-of-sysfs-RW-attrs-that-are-actually-RO.patch
|
||||||
Patch3: rtslib-target-service-for-suse.patch
|
Patch3: rtslib-target-service-for-suse.patch
|
||||||
Patch4: rbd-support-disable_emulate_legacy_capacity.patch
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module pyudev}
|
BuildRequires: %{python_module pyudev}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: %{python_module six}
|
BuildRequires: %{python_module six}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros >= 20210929
|
BuildRequires: python-rpm-macros >= 20210929
|
||||||
Requires: python-pyudev
|
|
||||||
%define oldpython python
|
|
||||||
%define cpkg %{oldpython}-rtslib-fb-common
|
|
||||||
Requires: %{cpkg}
|
Requires: %{cpkg}
|
||||||
|
Requires: python-pyudev
|
||||||
|
Requires: python-six
|
||||||
|
Provides: python-rtslib = %{version}-%{release}
|
||||||
|
Obsoletes: python-rtslib < %{version}
|
||||||
|
BuildArch: noarch
|
||||||
%if %{with libalternatives}
|
%if %{with libalternatives}
|
||||||
Requires: alts
|
|
||||||
BuildRequires: alts
|
BuildRequires: alts
|
||||||
|
Requires: alts
|
||||||
%else
|
%else
|
||||||
Requires(post): update-alternatives
|
Requires(post): update-alternatives
|
||||||
Requires(postun):update-alternatives
|
Requires(postun):update-alternatives
|
||||||
%endif
|
%endif
|
||||||
Provides: python-rtslib = %{version}-%{release}
|
|
||||||
Obsoletes: python-rtslib < %{version}
|
|
||||||
%if 0%{?sle_version} >= 150000
|
|
||||||
# explicit Provides advertising RBD support
|
|
||||||
Provides: python-rtslib-rbd = %{version}
|
|
||||||
Obsoletes: python-rtslib-rbd < %{version}
|
|
||||||
%endif
|
|
||||||
BuildArch: noarch
|
|
||||||
|
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -80,19 +73,14 @@ python2-rtslib-fb and python3-rtslib-fb.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n python-rtslib-fb-v%{version}
|
%setup -q -n python-rtslib-fb-v%{version}
|
||||||
%if 0%{?sle_version} >= 150000
|
|
||||||
# RBD support is dependent on LIO changes present in the SLE/Leap kernel
|
|
||||||
%patch1 -p1
|
|
||||||
%patch4 -p1
|
|
||||||
%endif
|
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_clone -a %{buildroot}/%{_bindir}/targetctl
|
%python_clone -a %{buildroot}/%{_bindir}/targetctl
|
||||||
%fdupes %{buildroot}
|
%fdupes %{buildroot}
|
||||||
install -d -m755 %{buildroot}%{_mandir}/man5
|
install -d -m755 %{buildroot}%{_mandir}/man5
|
||||||
@ -138,7 +126,9 @@ ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctarget
|
|||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%python_alternative %{_bindir}/targetctl
|
%python_alternative %{_bindir}/targetctl
|
||||||
%{python_sitelib}/*
|
%{python_sitelib}/rtslib
|
||||||
|
%{python_sitelib}/rtslib_fb
|
||||||
|
%{python_sitelib}/rtslib_fb-%{version}*-info
|
||||||
|
|
||||||
%files -n %{cpkg}
|
%files -n %{cpkg}
|
||||||
%license COPYING
|
%license COPYING
|
||||||
@ -148,7 +138,7 @@ ln -s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctarget
|
|||||||
%dir %{dbdir}/alua
|
%dir %{dbdir}/alua
|
||||||
%{_unitdir}/target.service
|
%{_unitdir}/target.service
|
||||||
%{_sbindir}/rctarget
|
%{_sbindir}/rctarget
|
||||||
%doc %{_mandir}/man5/saveconfig.json.5.gz
|
%{_mandir}/man5/saveconfig.json.5%{?ext_man}
|
||||||
%doc %{_mandir}/man8/targetctl.8.gz
|
%{_mandir}/man8/targetctl.8%{?ext_man}
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -1,96 +0,0 @@
|
|||||||
From 4e633572ef8a9b07d1ae1252cf4c2b2daf673998 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mykola Golub <mgolub@suse.com>
|
|
||||||
Date: Thu, 3 Feb 2022 18:40:47 +0000
|
|
||||||
Subject: [PATCH] disable emulate_legacy_capacity on creating RBD backstore
|
|
||||||
|
|
||||||
When rbd image has object-map feature set, `enable` will fail
|
|
||||||
unless emulate_legacy_capacity (default is 1) is set to 0.
|
|
||||||
|
|
||||||
Provide a possibility to disable emulate_legacy_capacity when
|
|
||||||
creating backstore (before enabling it) via additional
|
|
||||||
disable_emulate_legacy_capacity parameter.
|
|
||||||
|
|
||||||
We might eventually want to merge the rbd support patches into one,
|
|
||||||
but right now keeping them separate looks useful for tracking the
|
|
||||||
change (feature) added here.
|
|
||||||
|
|
||||||
This patch is for the changes added by "rbd support" patch
|
|
||||||
(rbd-support.patch) and thus it is not needed upstream until
|
|
||||||
the rbd support is added upstream.
|
|
||||||
|
|
||||||
Eventualy we might want to merge this and "rbd support" patches
|
|
||||||
into one. For now it looks useful to keep it separate to track
|
|
||||||
the change (feature) added by this patch.
|
|
||||||
|
|
||||||
ceph-iscsi needs this change to support rbd images with
|
|
||||||
object-map feature enabled.
|
|
||||||
|
|
||||||
Reviewed-by: David Disseldorp <ddiss@suse.de>
|
|
||||||
Signed-off-by: Mykola Golub <mgolub@suse.com>
|
|
||||||
---
|
|
||||||
rtslib/tcm.py | 16 +++++++++++++---
|
|
||||||
1 file changed, 13 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/rtslib/tcm.py b/rtslib/tcm.py
|
|
||||||
index d42a78f..3bf599d 100644
|
|
||||||
--- a/rtslib/tcm.py
|
|
||||||
+++ b/rtslib/tcm.py
|
|
||||||
@@ -809,7 +809,8 @@ class RBDStorageObject(StorageObject):
|
|
||||||
# RBDStorageObject private stuff
|
|
||||||
|
|
||||||
def __init__(self, name, dev=None, wwn=None, readonly=False,
|
|
||||||
- write_back=False, index=None):
|
|
||||||
+ write_back=False, index=None,
|
|
||||||
+ disable_emulate_legacy_capacity=False):
|
|
||||||
'''
|
|
||||||
A RBDIOStorageObject can be instantiated in two ways:
|
|
||||||
- B{Creation mode}: If I{dev} is specified, the underlying configFS
|
|
||||||
@@ -822,6 +823,10 @@ class RBDStorageObject(StorageObject):
|
|
||||||
I{name}. The underlying configFS object must already exist in
|
|
||||||
that mode, or instantiation will fail.
|
|
||||||
|
|
||||||
+ Note, setting disable_emulate_legacy_capacity to True is dangerous
|
|
||||||
+ for any image that has previously been iSCSI exported with
|
|
||||||
+ emulate_legacy_capacity enabled.
|
|
||||||
+
|
|
||||||
@param name: The name of the RBDIOStorageObject.
|
|
||||||
@type name: string
|
|
||||||
@param dev: The path to the backend rbd device to be used.
|
|
||||||
@@ -835,20 +840,23 @@ class RBDStorageObject(StorageObject):
|
|
||||||
@type readonly: boolean
|
|
||||||
@param write_back: Enable write back cache.
|
|
||||||
@type write_back: boolean
|
|
||||||
+ @param disable_emulate_legacy_capacity: Disable emulate_legacy_capacity mode.
|
|
||||||
+ @type disable_emulate_legacy_capacity: boolean
|
|
||||||
@return: A RBDIOStorageObject object.
|
|
||||||
'''
|
|
||||||
|
|
||||||
if dev is not None:
|
|
||||||
super(RBDStorageObject, self).__init__(name, 'create', index)
|
|
||||||
try:
|
|
||||||
- self._configure(dev, wwn, readonly)
|
|
||||||
+ self._configure(dev, wwn, readonly,
|
|
||||||
+ disable_emulate_legacy_capacity)
|
|
||||||
except:
|
|
||||||
self.delete()
|
|
||||||
raise
|
|
||||||
else:
|
|
||||||
super(RBDStorageObject, self).__init__(name, 'lookup', index)
|
|
||||||
|
|
||||||
- def _configure(self, dev, wwn, readonly):
|
|
||||||
+ def _configure(self, dev, wwn, readonly, disable_emulate_legacy_capacity):
|
|
||||||
self._check_self()
|
|
||||||
if get_blockdev_type(dev) != 0:
|
|
||||||
raise RTSLibError("Device %s is not a TYPE_DISK rbd device" % dev)
|
|
||||||
@@ -858,6 +866,8 @@ class RBDStorageObject(StorageObject):
|
|
||||||
self._set_udev_path(dev)
|
|
||||||
self._control("udev_path=%s" % dev)
|
|
||||||
self._control("readonly=%d" % readonly)
|
|
||||||
+ if disable_emulate_legacy_capacity:
|
|
||||||
+ self.set_attribute("emulate_legacy_capacity", 0)
|
|
||||||
self._enable()
|
|
||||||
|
|
||||||
super(RBDStorageObject, self)._configure(wwn)
|
|
||||||
--
|
|
||||||
2.33.1
|
|
||||||
|
|
@ -1,154 +0,0 @@
|
|||||||
From 9496352d515b9f440b68c8534e41899cf1a9570e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Mike Christie <mchristi@redhat.com>
|
|
||||||
Date: Wed, 29 Jul 2015 04:28:02 -0500
|
|
||||||
Subject: [PATCH] rbd support
|
|
||||||
|
|
||||||
rtslib-fb-rbd-support.patch obtained from:
|
|
||||||
https://marc.info/?l=ceph-devel&m=143816209010058
|
|
||||||
|
|
||||||
Reviewed-by: David Disseldorp <ddiss@suse.de>
|
|
||||||
---
|
|
||||||
rtslib/__init__.py | 1
|
|
||||||
rtslib/tcm.py | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
2 files changed, 104 insertions(+)
|
|
||||||
|
|
||||||
--- a/rtslib/__init__.py
|
|
||||||
+++ b/rtslib/__init__.py
|
|
||||||
@@ -32,6 +32,7 @@ from .fabric import FabricModule
|
|
||||||
|
|
||||||
from .tcm import FileIOStorageObject, BlockStorageObject
|
|
||||||
from .tcm import PSCSIStorageObject, RDMCPStorageObject, UserBackedStorageObject
|
|
||||||
+from .tcm import RBDStorageObject
|
|
||||||
from .tcm import StorageObjectFactory
|
|
||||||
|
|
||||||
from .alua import ALUATargetPortGroup
|
|
||||||
--- a/rtslib/tcm.py
|
|
||||||
+++ b/rtslib/tcm.py
|
|
||||||
@@ -801,6 +801,111 @@ class BlockStorageObject(StorageObject):
|
|
||||||
d['dev'] = self.udev_path
|
|
||||||
return d
|
|
||||||
|
|
||||||
+class RBDStorageObject(StorageObject):
|
|
||||||
+ '''
|
|
||||||
+ An interface to configFS storage objects for RBD backstore.
|
|
||||||
+ '''
|
|
||||||
+
|
|
||||||
+ # RBDStorageObject private stuff
|
|
||||||
+
|
|
||||||
+ def __init__(self, name, dev=None, wwn=None, readonly=False,
|
|
||||||
+ write_back=False, index=None):
|
|
||||||
+ '''
|
|
||||||
+ A RBDIOStorageObject can be instantiated in two ways:
|
|
||||||
+ - B{Creation mode}: If I{dev} is specified, the underlying configFS
|
|
||||||
+ object will be created with that parameter.
|
|
||||||
+ No RBDIOStorageObject with the same I{name} can pre-exist in
|
|
||||||
+ the parent Backstore in that mode.
|
|
||||||
+ - B{Lookup mode}: If I{dev} is not set, then the
|
|
||||||
+ RBDIOStorageObject will be bound to the existing configFS
|
|
||||||
+ object in the parent Backstore having the specified
|
|
||||||
+ I{name}. The underlying configFS object must already exist in
|
|
||||||
+ that mode, or instantiation will fail.
|
|
||||||
+
|
|
||||||
+ @param name: The name of the RBDIOStorageObject.
|
|
||||||
+ @type name: string
|
|
||||||
+ @param dev: The path to the backend rbd device to be used.
|
|
||||||
+ - Example: I{dev="/dev/sda"}.
|
|
||||||
+ - The only device type that is accepted I{TYPE_DISK}.
|
|
||||||
+ For other device types, use pscsi.
|
|
||||||
+ @type dev: string
|
|
||||||
+ @param wwn: T10 WWN Unit Serial, will generate if None
|
|
||||||
+ @type wwn: string
|
|
||||||
+ @param readonly: Use to read only.
|
|
||||||
+ @type readonly: boolean
|
|
||||||
+ @param write_back: Enable write back cache.
|
|
||||||
+ @type write_back: boolean
|
|
||||||
+ @return: A RBDIOStorageObject object.
|
|
||||||
+ '''
|
|
||||||
+
|
|
||||||
+ if dev is not None:
|
|
||||||
+ super(RBDStorageObject, self).__init__(name, 'create', index)
|
|
||||||
+ try:
|
|
||||||
+ self._configure(dev, wwn, readonly)
|
|
||||||
+ except:
|
|
||||||
+ self.delete()
|
|
||||||
+ raise
|
|
||||||
+ else:
|
|
||||||
+ super(RBDStorageObject, self).__init__(name, 'lookup', index)
|
|
||||||
+
|
|
||||||
+ def _configure(self, dev, wwn, readonly):
|
|
||||||
+ self._check_self()
|
|
||||||
+ if get_blockdev_type(dev) != 0:
|
|
||||||
+ raise RTSLibError("Device %s is not a TYPE_DISK rbd device" % dev)
|
|
||||||
+ if is_dev_in_use(dev):
|
|
||||||
+ raise RTSLibError("Cannot configure StorageObject because "
|
|
||||||
+ + "device %s is already in use" % dev)
|
|
||||||
+ self._set_udev_path(dev)
|
|
||||||
+ self._control("udev_path=%s" % dev)
|
|
||||||
+ self._control("readonly=%d" % readonly)
|
|
||||||
+ self._enable()
|
|
||||||
+
|
|
||||||
+ super(RBDStorageObject, self)._configure(wwn)
|
|
||||||
+
|
|
||||||
+ def _get_major(self):
|
|
||||||
+ self._check_self()
|
|
||||||
+ return int(self._parse_info('Major'))
|
|
||||||
+
|
|
||||||
+ def _get_minor(self):
|
|
||||||
+ self._check_self()
|
|
||||||
+ return int(self._parse_info('Minor'))
|
|
||||||
+
|
|
||||||
+ def _get_size(self):
|
|
||||||
+ # udev_path doesn't work here, what if LV gets renamed?
|
|
||||||
+ return get_size_for_disk_name(self._parse_info('device')) * int(self._parse_info('SectorSize'))
|
|
||||||
+
|
|
||||||
+ def _get_wb_enabled(self):
|
|
||||||
+ self._check_self()
|
|
||||||
+ return bool(int(self.get_attribute("emulate_write_cache")))
|
|
||||||
+
|
|
||||||
+ def _get_readonly(self):
|
|
||||||
+ self._check_self()
|
|
||||||
+ # 'readonly' not present before kernel 3.6
|
|
||||||
+ try:
|
|
||||||
+ return bool(int(self._parse_info('readonly')))
|
|
||||||
+ except AttributeError:
|
|
||||||
+ return False
|
|
||||||
+
|
|
||||||
+ # RBDStorageObject public stuff
|
|
||||||
+
|
|
||||||
+ major = property(_get_major,
|
|
||||||
+ doc="Get the block device major number")
|
|
||||||
+ minor = property(_get_minor,
|
|
||||||
+ doc="Get the block device minor number")
|
|
||||||
+ size = property(_get_size,
|
|
||||||
+ doc="Get the block device size")
|
|
||||||
+ write_back = property(_get_wb_enabled,
|
|
||||||
+ doc="True if write-back, False if write-through (write cache disabled)")
|
|
||||||
+ readonly = property(_get_readonly,
|
|
||||||
+ doc="True if the device is read-only, False if read/write")
|
|
||||||
+
|
|
||||||
+ def dump(self):
|
|
||||||
+ d = super(RBDStorageObject, self).dump()
|
|
||||||
+ d['write_back'] = self.write_back
|
|
||||||
+ d['readonly'] = self.readonly
|
|
||||||
+ d['wwn'] = self.wwn
|
|
||||||
+ d['dev'] = self.udev_path
|
|
||||||
+ return d
|
|
||||||
|
|
||||||
class UserBackedStorageObject(StorageObject):
|
|
||||||
'''
|
|
||||||
@@ -940,6 +1041,7 @@ so_mapping = {
|
|
||||||
"fileio": FileIOStorageObject,
|
|
||||||
"iblock": BlockStorageObject,
|
|
||||||
"block": BlockStorageObject,
|
|
||||||
+ "rbd": RBDStorageObject,
|
|
||||||
"user": UserBackedStorageObject,
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -950,6 +1052,7 @@ bs_params = {
|
|
||||||
FileIOStorageObject: dict(name='fileio'),
|
|
||||||
BlockStorageObject: dict(name='block', alt_dirprefix='iblock'),
|
|
||||||
UserBackedStorageObject: dict(name='user'),
|
|
||||||
+ RBDStorageObject: dict(name='rbd'),
|
|
||||||
}
|
|
||||||
|
|
||||||
bs_cache = {}
|
|
Loading…
Reference in New Issue
Block a user