From 16bf2825ad7b71f533ea3f9eb041168c586edb6f Mon Sep 17 00:00:00 2001 From: Chris Yeoh Date: Fri, 27 Sep 2013 17:04:44 +0930 Subject: [PATCH] Adds IpAddressGenerationFailureClient exception Adds the IpAddressGenerationFailureClient exception so a more specific exception than NeutronClientException is raised when IPs run out. This will allow for better exception handling in Nova and help fix nova bug 1212137 Change-Id: I921ba5d5f5ee3dc9620dcdbbd04d6fef824c9a53 Closes-Bug: 1231836 --- neutronclient/common/exceptions.py | 4 ++++ neutronclient/v2_0/client.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/neutronclient/common/exceptions.py b/neutronclient/common/exceptions.py index c2b8b3c..b9485ec 100644 --- a/neutronclient/common/exceptions.py +++ b/neutronclient/common/exceptions.py @@ -90,6 +90,10 @@ class AlreadyAttachedClient(NeutronClientException): pass +class IpAddressGenerationFailureClient(NeutronClientException): + pass + + class Unauthorized(NeutronClientException): message = _("Unauthorized: bad credentials.") diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py index 5a094ce..cc8f705 100644 --- a/neutronclient/v2_0/client.py +++ b/neutronclient/v2_0/client.py @@ -49,7 +49,9 @@ def exception_handler_v20(status_code, error_content): 'PortNotFound': exceptions.PortNotFoundClient, 'RequestedStateInvalid': exceptions.StateInvalidClient, 'PortInUse': exceptions.PortInUseClient, - 'AlreadyAttached': exceptions.AlreadyAttachedClient, } + 'AlreadyAttached': exceptions.AlreadyAttachedClient, + 'IpAddressGenerationFailure': + exceptions.IpAddressGenerationFailureClient, } error_dict = None if isinstance(error_content, dict):