Browse Source

Retry on internal server error 98

Change-Id: I4dbc7d1f34b7d7672b8fca8e8667e2d266faca14
changes/82/706182/1
asarfaty Adit Sarfaty 1 month ago
parent
commit
01aa48a5d3
2 changed files with 10 additions and 3 deletions
  1. +5
    -2
      vmware_nsxlib/v3/client.py
  2. +5
    -1
      vmware_nsxlib/v3/exceptions.py

+ 5
- 2
vmware_nsxlib/v3/client.py View File

@@ -46,7 +46,8 @@ def http_error_to_exception(status_code, error_code):
requests.codes.CONFLICT: exceptions.StaleRevision,
requests.codes.PRECONDITION_FAILED: exceptions.StaleRevision,
requests.codes.INTERNAL_SERVER_ERROR:
{'99': exceptions.ClientCertificateNotTrusted,
{'98': exceptions.CannotConnectToServer,
'99': exceptions.ClientCertificateNotTrusted,
'607': exceptions.APITransactionAborted},
requests.codes.FORBIDDEN:
{'98': exceptions.BadXSRFToken},
@@ -323,7 +324,9 @@ class NSX3Client(JSONRESTClient):
def _rest_call(self, url, **kwargs):
if kwargs.get('with_retries', True):
# Retry on "607: Persistence layer is currently reconfiguring"
retry_codes = [exceptions.APITransactionAborted]
# and on "98: Cannot connect to server"
retry_codes = [exceptions.APITransactionAborted,
exceptions.CannotConnectToServer]
if self.rate_limit_retry:
# If too many requests are handled by the nsx at the same time,
# error "429: Too Many Requests" or "503: Server Unavailable"


+ 5
- 1
vmware_nsxlib/v3/exceptions.py View File

@@ -220,10 +220,14 @@ class NsxOverlapVlan(NsxLibInvalidInput):
"physical devices resulting in a conflict")


class APITransactionAborted(ServerBusy):
class APITransactionAborted(ManagerError):
message = _("API transaction aborted as MP cluster is reconfiguring")


class CannotConnectToServer(ManagerError):
message = _("Cannot connect to server")


class ResourceInUse(ManagerError):
message = _("The object cannot be deleted as either it has children or it "
"is being referenced by other objects")

Loading…
Cancel
Save