Retry router removal on conflict
Manila injects share network to tenant router underhood,
the interface removal is asynchronous in manila. This is
only one example when conflict migh happen. Since rest assumes
we can retry on Conflicts, do it here.
Related-Prod: PRODX-27590
Change-Id: I3c284673abf13e2c01ebca047c353de1207caf12
(cherry picked from commit 1ea945680d2a7731ebe16d322721b79b4fb13b26)
(cherry picked from commit 10b982cb6f59d754407ef35b89cabc513c47607b)
diff --git a/requirements.txt b/requirements.txt
index a1eff53..a9046fb 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -21,3 +21,4 @@
defusedxml>=0.7.1 # PSFL
fasteners>=0.16.0 # Apache-2.0
testscenarios>=0.5.0
+tenacity>=4.4.0 # Apache-2.0
diff --git a/tempest/lib/common/constants.py b/tempest/lib/common/constants.py
new file mode 100644
index 0000000..57fdd93
--- /dev/null
+++ b/tempest/lib/common/constants.py
@@ -0,0 +1,5 @@
+# Retry constants
+RETRY_ATTEMPTS = 30
+RETRY_INITIAL_DELAY = 1
+RETRY_BACKOFF = 3
+RETRY_MAX = 10
diff --git a/tempest/lib/common/dynamic_creds.py b/tempest/lib/common/dynamic_creds.py
index 5890b55..a9aba4d 100644
--- a/tempest/lib/common/dynamic_creds.py
+++ b/tempest/lib/common/dynamic_creds.py
@@ -16,7 +16,9 @@
import netaddr
from oslo_log import log as logging
+import tenacity
+import tempest.lib.common.constants as const
from tempest.lib.common import cred_client
from tempest.lib.common import cred_provider
from tempest.lib.common.utils import data_utils
@@ -539,6 +541,11 @@
del self._creds[creds_name]
return self.get_credentials(roles, scope=scope, by_role=True)
+ @tenacity.retry(
+ retry=tenacity.retry_if_exception_type(lib_exc.Conflict),
+ wait=tenacity.wait_incrementing(
+ const.RETRY_INITIAL_DELAY, const.RETRY_BACKOFF, const.RETRY_MAX),
+ stop=tenacity.stop_after_attempt(const.RETRY_ATTEMPTS))
def _clear_isolated_router(self, router_id, router_name):
client = self.routers_admin_client
try: