diff --git a/python-rtslib-fb.changes b/python-rtslib-fb.changes index a9b2736..9d31c6a 100644 --- a/python-rtslib-fb.changes +++ b/python-rtslib-fb.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Jan 30 17:07:00 UTC 2022 - Mykola Golub + +- Update parameters description in rbd-support.patch +- Add rbd-support-disable_emulate_legacy_capacity.patch + ------------------------------------------------------------------- Thu Sep 30 19:14:14 UTC 2021 - Stefan Schubert diff --git a/python-rtslib-fb.spec b/python-rtslib-fb.spec index 16ecfad..10881bb 100644 --- a/python-rtslib-fb.spec +++ b/python-rtslib-fb.spec @@ -1,7 +1,7 @@ # # spec file for package python-rtslib-fb # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -35,6 +35,7 @@ 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 Patch3: rtslib-target-service-for-suse.patch +Patch4: rbd-support-disable_emulate_legacy_capacity.patch BuildRequires: %{python_module pyudev} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module six} @@ -81,6 +82,7 @@ python2-rtslib-fb and python3-rtslib-fb. %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 %patch3 -p1 diff --git a/rbd-support-disable_emulate_legacy_capacity.patch b/rbd-support-disable_emulate_legacy_capacity.patch new file mode 100644 index 0000000..56d757f --- /dev/null +++ b/rbd-support-disable_emulate_legacy_capacity.patch @@ -0,0 +1,96 @@ +From 4e633572ef8a9b07d1ae1252cf4c2b2daf673998 Mon Sep 17 00:00:00 2001 +From: Mykola Golub +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 +Signed-off-by: Mykola Golub +--- + 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 + diff --git a/rbd-support.patch b/rbd-support.patch index f203253..295f7ba 100644 --- a/rbd-support.patch +++ b/rbd-support.patch @@ -24,7 +24,7 @@ Reviewed-by: David Disseldorp from .alua import ALUATargetPortGroup --- a/rtslib/tcm.py +++ b/rtslib/tcm.py -@@ -801,6 +801,107 @@ class BlockStorageObject(StorageObject): +@@ -801,6 +801,111 @@ class BlockStorageObject(StorageObject): d['dev'] = self.udev_path return d @@ -58,6 +58,10 @@ Reviewed-by: David Disseldorp + @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. + ''' +