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
parent 0272e1e3cf
commit dc3570c7db
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.INTERNAL_SERVER_ERROR, 98, [777])
self.assertEqual(exc, nsxlib_exc.CannotConnectToServer)

View File

@ -52,7 +52,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},
requests.codes.TOO_MANY_REQUESTS: exceptions.TooManyRequests,