diff --git a/vmware_nsxlib/v3/client.py b/vmware_nsxlib/v3/client.py index 607f1fff..eaf6c1b1 100644 --- a/vmware_nsxlib/v3/client.py +++ b/vmware_nsxlib/v3/client.py @@ -80,6 +80,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}, diff --git a/vmware_nsxlib/v3/policy/transaction.py b/vmware_nsxlib/v3/policy/transaction.py index 03bc6157..624e3e9f 100644 --- a/vmware_nsxlib/v3/policy/transaction.py +++ b/vmware_nsxlib/v3/policy/transaction.py @@ -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():