Tier-1: Retry when removing edge cluster

Retry operation is a StaleRevision error is returned
from the backend.

Change-Id: I637b9d1e6a23767d9297cec115cceaa573257329
This commit is contained in:
Salvatore Orlando 2023-04-17 00:45:08 -07:00
parent 3a627ed498
commit ce621cfc80
1 changed files with 13 additions and 6 deletions

View File

@ -1317,12 +1317,19 @@ class NsxPolicyTier1Api(NsxPolicyResourceBase):
def remove_edge_cluster(self, tier1_id,
tenant=constants.POLICY_INFRA_TENANT):
"""Reset the path in the locale-service (deleting it is not allowed)"""
t1service_def = core_defs.Tier1LocaleServiceDef(
tier1_id=tier1_id,
service_id=self._locale_service_id(tier1_id),
edge_cluster_path="",
tenant=tenant)
self.policy_api.create_or_update(t1service_def)
@utils.retry_upon_exception(
exceptions.StaleRevision,
max_attempts=self.policy_api.client.max_attempts)
def do_remove_edge_cluster(tier1_id, tenant):
t1service_def = core_defs.Tier1LocaleServiceDef(
tier1_id=tier1_id,
service_id=self._locale_service_id(tier1_id),
edge_cluster_path="",
tenant=tenant)
self.policy_api.create_or_update(t1service_def)
do_remove_edge_cluster(tier1_id, tenant)
def get_edge_cluster_path(self, tier1_id,
tenant=constants.POLICY_INFRA_TENANT):