diff --git a/vmware_nsxlib/tests/unit/v3/test_client.py b/vmware_nsxlib/tests/unit/v3/test_client.py index 6456e980..22677459 100644 --- a/vmware_nsxlib/tests/unit/v3/test_client.py +++ b/vmware_nsxlib/tests/unit/v3/test_client.py @@ -318,6 +318,9 @@ class NsxV3RESTClientTestCase(nsxlib_testcase.NsxClientTestCase): exc = client.http_error_to_exception(500, 610) self.assertEqual(exc, nsxlib_exc.APITransactionAborted) + exc = client.http_error_to_exception(500, 60506) + self.assertEqual(exc, nsxlib_exc.NsxSearchDataTooLarge) + exc = client.http_error_to_exception(requests.codes.FORBIDDEN, 505) self.assertEqual(exc, nsxlib_exc.InvalidLicense) diff --git a/vmware_nsxlib/v3/client.py b/vmware_nsxlib/v3/client.py index 84b52d5e..e85085c0 100644 --- a/vmware_nsxlib/v3/client.py +++ b/vmware_nsxlib/v3/client.py @@ -120,7 +120,8 @@ def http_error_to_exception(status_code, error_code, related_error_codes=None): {'98': exceptions.CannotConnectToServer, '99': exceptions.ClientCertificateNotTrusted, '607': exceptions.APITransactionAborted, - '610': exceptions.APITransactionAborted}, + '610': exceptions.APITransactionAborted, + '60506': exceptions.NsxSearchDataTooLarge}, requests.codes.FORBIDDEN: {'98': exceptions.BadXSRFToken, '403': exceptions.InvalidCredentials, diff --git a/vmware_nsxlib/v3/config.py b/vmware_nsxlib/v3/config.py index e4a65a44..581213ab 100644 --- a/vmware_nsxlib/v3/config.py +++ b/vmware_nsxlib/v3/config.py @@ -37,7 +37,8 @@ class ExceptionConfig(object): # mark endpoint as DOWN self.retriables = [v3_exceptions.APITransactionAborted, v3_exceptions.CannotConnectToServer, - v3_exceptions.ServerBusy] + v3_exceptions.ServerBusy, + v3_exceptions.NsxSearchDataTooLarge] # When hit during API call, these exceptions will be retried # after the endpoints are regenerated with up-to-date auth diff --git a/vmware_nsxlib/v3/exceptions.py b/vmware_nsxlib/v3/exceptions.py index 0a576e4d..26792601 100644 --- a/vmware_nsxlib/v3/exceptions.py +++ b/vmware_nsxlib/v3/exceptions.py @@ -211,6 +211,10 @@ class NsxSearchPipelineError(NsxLibException): message = _("Exception while searching during pipeline execution") +class NsxSearchDataTooLarge(NsxLibException): + message = _("Size of data returned by search is too large") + + class NsxPendingDelete(NsxLibException): message = _("An object with the same name is marked for deletion. Either " "use another path or wait for the purge cycle to permanently "