Add MP610 error code to retryable errors

Erro code 610 is thrown when a NSX transaction is stopped.
The transaction should be retried by the client.

This change ensures erro 610 is handled with APITransactionAborted
exception and therefore retried.

Change-Id: Ice1d712f78ffb5e9ea12fc485e3d4ac52167f678
This commit is contained in:
Salvatore Orlando 2021-08-30 01:48:54 -07:00 committed by Salvatore Orlando
parent 6f7909219c
commit 4250a951d6
2 changed files with 5 additions and 1 deletions

View File

@ -314,6 +314,9 @@ class NsxV3RESTClientTestCase(nsxlib_testcase.NsxClientTestCase):
exc = client.http_error_to_exception(500, 607)
self.assertEqual(exc, nsxlib_exc.APITransactionAborted)
exc = client.http_error_to_exception(500, 610)
self.assertEqual(exc, nsxlib_exc.APITransactionAborted)
exc = client.http_error_to_exception(requests.codes.FORBIDDEN, 505)
self.assertEqual(exc, nsxlib_exc.InvalidLicense)

View File

@ -91,7 +91,8 @@ def http_error_to_exception(status_code, error_code, related_error_codes=None):
requests.codes.INTERNAL_SERVER_ERROR:
{'98': exceptions.CannotConnectToServer,
'99': exceptions.ClientCertificateNotTrusted,
'607': exceptions.APITransactionAborted},
'607': exceptions.APITransactionAborted,
'610': exceptions.APITransactionAborted},
requests.codes.FORBIDDEN:
{'98': exceptions.BadXSRFToken,
'403': exceptions.InvalidCredentials,