summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Hill <dhill@redhat.com>2020-10-22 18:56:19 -0400
committerLuigi Toscano <ltoscano@redhat.com>2020-11-03 16:29:10 +0100
commit66aad39a44cb7e4ac108624dd3c886241096c1cf (patch)
treea59478574fb111d8897ec960e06af8235962203a
parent463c17a3f95f37c4c3edd1eadc5b474893c8adba (diff)
downloadcinder-66aad39a44cb7e4ac108624dd3c886241096c1cf.tar.gz
Do not fail when depth is greater than rbd_max_clone_depth
Removed a sanity check in the code that raised an exception if the clone depth of a volume to be cloned exceeded the rbd_max_clone_depth config value. A consequence of this check was that if an operator lowered the value, volumes whose clone depth was greater than the new value (as would be allowed by the previous, higher setting) could no longer be cloned. Change-Id: I8c445058a25c2eca2fda91bdeb6befedae34ccf2 Closes-bug: #1901241 (cherry picked from commit 8d8d242c3924037e6774a681efabce4893a26646) (cherry picked from commit 23a821b2a4bbb5696bc27044a455fc7837641111) (cherry picked from commit f6e5fe187ea947fd7d4624a4f456dd7e11c35c7d) (cherry picked from commit 0a3345cc0589f93e09bf55e02502e14f6e58e70e)
-rw-r--r--cinder/volume/drivers/rbd.py12
-rw-r--r--releasenotes/notes/bug-1901241-361b1b361bfa5152.yaml8
2 files changed, 12 insertions, 8 deletions
diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py
index b9d110ee9..959c6b01b 100644
--- a/cinder/volume/drivers/rbd.py
+++ b/cinder/volume/drivers/rbd.py
@@ -83,7 +83,9 @@ RBD_OPTS = [
default=5,
help='Maximum number of nested volume clones that are '
'taken before a flatten occurs. Set to 0 to disable '
- 'cloning.'),
+ 'cloning. Note: lowering this value will not affect '
+ 'existing volumes whose clone depth exceeds the new '
+ 'value.'),
cfg.IntOpt('rbd_store_chunk_size', default=4,
help='Volumes will be chunked into objects of this size '
'(in megabytes).'),
@@ -607,12 +609,6 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
if not parent:
return depth
- # If clone depth was reached, flatten should have occurred so if it has
- # been exceeded then something has gone wrong.
- if depth > self.configuration.rbd_max_clone_depth:
- raise Exception(_("clone depth exceeds limit of %s") %
- (self.configuration.rbd_max_clone_depth))
-
return self._get_clone_depth(client, parent, depth + 1)
def _extend_if_required(self, volume, src_vref):
@@ -682,7 +678,7 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
depth = self._get_clone_depth(client, src_name)
# If dest volume is a clone and rbd_max_clone_depth reached,
# flatten the dest after cloning. Zero rbd_max_clone_depth means
- # infinite is allowed.
+ # volumes are always flattened.
if depth >= self.configuration.rbd_max_clone_depth:
LOG.info("maximum clone depth (%d) has been reached - "
"flattening dest volume",
diff --git a/releasenotes/notes/bug-1901241-361b1b361bfa5152.yaml b/releasenotes/notes/bug-1901241-361b1b361bfa5152.yaml
new file mode 100644
index 000000000..7609cfe9d
--- /dev/null
+++ b/releasenotes/notes/bug-1901241-361b1b361bfa5152.yaml
@@ -0,0 +1,8 @@
+---
+fixes:
+ - |
+ RBD driver `bug #1901241
+ <https://bugs.launchpad.net/cinder/+bug/1901241>`_:
+ Fixed an issue where decreasing the ``rbd_max_clone_depth`` configuration
+ option would prevent volumes that had already exceeded that depth from
+ being cloned.