From de1de539fbdbf16b09e5d1edb9a2317d9140ab0b Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Tue, 17 Oct 2017 18:57:05 +0300 Subject: [PATCH] NSX|V: Fix vcns timeout exception Using a dedicated timeout exception for vcns calls timeout The exception used before was logged as 'unprintable' since it didn't include the relevant parameters Change-Id: I706f3819ecaa180752e7c1926f7ec63510962f3a --- vmware_nsx/plugins/nsx_v/vshield/common/VcnsApiClient.py | 2 +- vmware_nsx/plugins/nsx_v/vshield/common/exceptions.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/vmware_nsx/plugins/nsx_v/vshield/common/VcnsApiClient.py b/vmware_nsx/plugins/nsx_v/vshield/common/VcnsApiClient.py index 53bbb8e6e3..b68ec1b945 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/common/VcnsApiClient.py +++ b/vmware_nsx/plugins/nsx_v/vshield/common/VcnsApiClient.py @@ -144,7 +144,7 @@ class VcnsApiHelper(object): headers=headers, timeout=self.timeout) except requests.exceptions.Timeout: - raise exceptions.VcnsApiException(uri=uri) + raise exceptions.ResourceTimedOut(uri=uri) status = response.status_code diff --git a/vmware_nsx/plugins/nsx_v/vshield/common/exceptions.py b/vmware_nsx/plugins/nsx_v/vshield/common/exceptions.py index 397d507a55..26a77b8761 100644 --- a/vmware_nsx/plugins/nsx_v/vshield/common/exceptions.py +++ b/vmware_nsx/plugins/nsx_v/vshield/common/exceptions.py @@ -62,6 +62,10 @@ class ResourceNotFound(VcnsApiException): message = _("Resource %(uri)s not found") +class ResourceTimedOut(VcnsApiException): + message = _("Resource %(uri)s timed out") + + class MediaTypeUnsupport(VcnsApiException): message = _("Media Type %(uri)s is not supported")