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)
Reviewed: https:/ /review. opendev. org/c/openstack /glance_ store/+ /839203 /opendev. org/openstack/ glance_ store/commit/ c6716cb8fbbdd75 b3c5ce36f5fc9ce de8b83bc0d
Committed: https:/
Submitter: "Zuul (22348)"
Branch: stable/yoga
commit c6716cb8fbbdd75 b3c5ce36f5fc9ce de8b83bc0d
Author: whoami-rajat <email address hidden>
Date: Mon Apr 18 21:43:14 2022 +0530
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: I0094b044085d7f 92b07ea86236de3 b6efd7d67ea 2f8cf396098891f 4cbe7b30fb)
(cherry picked from commit ba4af147fb93d52