Retry policy create by PATCH in case of NsxPendingDelete error
In some cases, the same object with the same ID is created just after it was deleted. In this case the NSX might through NsxPendingDelete error, and we should retry the creation. Change-Id: Iefbfc88d2111fc12ed7242df4b77c83b9323c34c
This commit is contained in:
parent
4aeb0e43cb
commit
468c3effba
@ -286,7 +286,15 @@ class NsxPolicyResourceBase(object):
|
||||
if child_def:
|
||||
self.policy_api.create_with_parent(policy_def, child_def)
|
||||
else:
|
||||
self.policy_api.create_or_update(policy_def)
|
||||
# in case the same object was just deleted, create may need to
|
||||
# be retried
|
||||
@utils.retry_upon_exception(
|
||||
exceptions.NsxPendingDelete,
|
||||
max_attempts=self.policy_api.client.max_attempts)
|
||||
def _do_create_with_retry():
|
||||
self.policy_api.create_or_update(policy_def)
|
||||
|
||||
_do_create_with_retry()
|
||||
|
||||
|
||||
class NsxPolicyDomainApi(NsxPolicyResourceBase):
|
||||
|
Loading…
x
Reference in New Issue
Block a user