Browse Source

Merge "NSXV: Handle requests ConnectionError exception"

changes/73/788473/1
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
a36c11a833
3 changed files with 8 additions and 0 deletions
  1. +3
    -0
      vmware_nsx/plugins/nsx_v/vshield/common/VcnsApiClient.py
  2. +4
    -0
      vmware_nsx/plugins/nsx_v/vshield/common/exceptions.py
  3. +1
    -0
      vmware_nsx/plugins/nsx_v/vshield/vcns.py

+ 3
- 0
vmware_nsx/plugins/nsx_v/vshield/common/VcnsApiClient.py View File

@ -168,6 +168,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:


+ 4
- 0
vmware_nsx/plugins/nsx_v/vshield/common/exceptions.py 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")

+ 1
- 0
vmware_nsx/plugins/nsx_v/vshield/vcns.py View File

@ -124,6 +124,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,


Loading…
Cancel
Save