Merge "NSXV: Handle requests ConnectionError exception" into stable/train

This commit is contained in:
Zuul 2021-04-19 14:22:57 +00:00 committed by Gerrit Code Review
commit 07686e11ed
3 changed files with 8 additions and 0 deletions

View File

@ -170,6 +170,9 @@ class VcnsApiHelper(object):
except requests.exceptions.Timeout:
raise exceptions.ResourceTimedOut(uri=uri)
except requests.exceptions.ConnectionError:
raise exceptions.ResourceConnectionError(uri=uri)
status = response.status_code
if 200 <= status < 300:

View File

@ -80,3 +80,7 @@ class ServiceConflict(VcnsApiException):
class AlreadyExists(VcnsApiException):
message = _("Resource %(resource)s already exists")
class ResourceConnectionError(VcnsApiException):
message = _("Resource %(uri)s connection error")

View File

@ -125,6 +125,7 @@ class Vcns(object):
self._normalized_global_objects = None
@retry_upon_exception(exceptions.ServiceConflict)
@retry_upon_exception(exceptions.ResourceConnectionError)
def _client_request(self, client, method, uri,
params, headers, encodeParams, timeout=None):
return client(method, uri, params, headers, encodeParams,