Add retry on StaleRevision for transactions
Change-Id: I9bc9ae59833833f1c093de29b00a82b828f1935c
This commit is contained in:
parent
be35d1dc11
commit
29981ce489
@ -87,6 +87,7 @@ def http_error_to_exception(status_code, error_code):
|
||||
'8327': exceptions.NsxOverlapVlan,
|
||||
'500045': exceptions.NsxPendingDelete,
|
||||
'500030': exceptions.ResourceInUse,
|
||||
'500087': exceptions.StaleRevision,
|
||||
'500105': exceptions.NsxOverlapAddresses,
|
||||
'503040': exceptions.NsxSegemntWithVM,
|
||||
'100148': exceptions.StaleRevision},
|
||||
|
@ -22,6 +22,7 @@ from vmware_nsxlib.v3 import exceptions
|
||||
|
||||
from vmware_nsxlib.v3.policy import constants
|
||||
from vmware_nsxlib.v3.policy import core_defs
|
||||
from vmware_nsxlib.v3 import utils
|
||||
|
||||
|
||||
class NsxPolicyTransactionException(exceptions.NsxLibException):
|
||||
@ -190,7 +191,14 @@ class NsxPolicyTransaction(object):
|
||||
resource_def.get_delete()))
|
||||
if body:
|
||||
headers = {'nsx-enable-partial-patch': 'true'}
|
||||
self.client.patch(url, body, headers=headers)
|
||||
|
||||
@utils.retry_upon_exception(
|
||||
(exceptions.NsxPendingDelete, exceptions.StaleRevision),
|
||||
max_attempts=self.client.max_attempts)
|
||||
def _do_patch_with_retry():
|
||||
self.client.patch(url, body, headers=headers)
|
||||
|
||||
_do_patch_with_retry()
|
||||
|
||||
@staticmethod
|
||||
def get_current():
|
||||
|
Loading…
x
Reference in New Issue
Block a user