summaryrefslogtreecommitdiff
path: root/glance_store/common
diff options
context:
space:
mode:
authorwhoami-rajat <rajatdhasmana@gmail.com>2022-04-18 21:43:14 +0530
committerwhoami-rajat <rajatdhasmana@gmail.com>2022-04-18 22:23:49 +0530
commitba4af147fb93d522f8cf396098891f4cbe7b30fb (patch)
treed8e3ef2b2e2b4d89f4d89b57766692ec498dc316 /glance_store/common
parent77919e15d281e908de7b687e2af927b59d3dc8a8 (diff)
downloadglance_store-ba4af147fb93d522f8cf396098891f4cbe7b30fb.tar.gz
Correct retry interval during attach volume
When we try to simultaneously attach same volume multiple times (multiattach), there are multiple attachments created, suppose attachA and attachB. If attachA marks the volume "reserved" then attachB can't proceed until the volume is in "in-use" or "available" state. We retry until we reach any of these states for which we use the retrying library. The retrying library defaults to 1 second retry[1] (5 times) which causes the original failure as the volume takes time to transition between "reserved" -> "in-use" state. This patch corrects it by adding an exponential retry time and max exponential retry i.e. 1: 2 ** 1 = 2 seconds 2: 2 ** 2 = 4 seconds 3: 2 ** 3 = 8 seconds 4: 2 ** 4 = 16 seconds (but max wait time is 10 seconds) 5: 2 ** 5 = 32 seconds (but max wait time is 10 seconds) [1] https://github.com/rholder/retrying/blob/master/retrying.py#L84 Closes-Bug: #1969373 Change-Id: I0094b044085d7f92b07ea86236de3b6efd7d67ea
Diffstat (limited to 'glance_store/common')
-rw-r--r--glance_store/common/cinder_utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/glance_store/common/cinder_utils.py b/glance_store/common/cinder_utils.py
index b3739a8..b14aa23 100644
--- a/glance_store/common/cinder_utils.py
+++ b/glance_store/common/cinder_utils.py
@@ -71,7 +71,9 @@ class API(object):
client.volumes.delete(volume_id)
@retrying.retry(stop_max_attempt_number=5,
- retry_on_exception=_retry_on_bad_request)
+ retry_on_exception=_retry_on_bad_request,
+ wait_exponential_multiplier=1000,
+ wait_exponential_max=10000)
@handle_exceptions
def attachment_create(self, client, volume_id, connector=None,
mountpoint=None, mode=None):