Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:ALP:Source:Standard:0.1
python-rtslib-fb
rbd-support-disable_emulate_legacy_capacity.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File rbd-support-disable_emulate_legacy_capacity.patch of Package python-rtslib-fb
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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor