Add retry on StaleRevision for transactions
Change-Id: I9bc9ae59833833f1c093de29b00a82b828f1935c
This commit is contained in:
parent
f9feaa987e
commit
9cf2d88ed8
@ -80,6 +80,7 @@ def http_error_to_exception(status_code, error_code):
|
|||||||
'8327': exceptions.NsxOverlapVlan,
|
'8327': exceptions.NsxOverlapVlan,
|
||||||
'500045': exceptions.NsxPendingDelete,
|
'500045': exceptions.NsxPendingDelete,
|
||||||
'500030': exceptions.ResourceInUse,
|
'500030': exceptions.ResourceInUse,
|
||||||
|
'500087': exceptions.StaleRevision,
|
||||||
'500105': exceptions.NsxOverlapAddresses,
|
'500105': exceptions.NsxOverlapAddresses,
|
||||||
'503040': exceptions.NsxSegemntWithVM,
|
'503040': exceptions.NsxSegemntWithVM,
|
||||||
'100148': exceptions.StaleRevision},
|
'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 constants
|
||||||
from vmware_nsxlib.v3.policy import core_defs
|
from vmware_nsxlib.v3.policy import core_defs
|
||||||
|
from vmware_nsxlib.v3 import utils
|
||||||
|
|
||||||
|
|
||||||
class NsxPolicyTransactionException(exceptions.NsxLibException):
|
class NsxPolicyTransactionException(exceptions.NsxLibException):
|
||||||
@ -190,7 +191,14 @@ class NsxPolicyTransaction(object):
|
|||||||
resource_def.get_delete()))
|
resource_def.get_delete()))
|
||||||
if body:
|
if body:
|
||||||
headers = {'nsx-enable-partial-patch': 'true'}
|
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
|
@staticmethod
|
||||||
def get_current():
|
def get_current():
|
||||||
|
Loading…
Reference in New Issue
Block a user