From 0d532673d7667f30828cb4e62e5f9ed0260f6bf0 Mon Sep 17 00:00:00 2001 From: Chris Yeoh Date: Mon, 30 Sep 2013 22:30:10 +0930 Subject: [PATCH] Adds ExternalIpAddressExhaustedClient exception Adds the ExternalIpAddressExhaustedClient exception so a more specific exception than NeutronClientException is raised when IPs run out. This will allow for better exception handling in Nova. Closes-Bug: 1233143 Change-Id: I9f40bf14eec0f485dfd21b36605a2474b99a8941 --- 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 b9485ecb8..b3ab4d7a1 100644 --- a/neutronclient/common/exceptions.py +++ b/neutronclient/common/exceptions.py @@ -94,6 +94,10 @@ class IpAddressGenerationFailureClient(NeutronClientException): pass +class ExternalIpAddressExhaustedClient(NeutronClientException): + pass + + class Unauthorized(NeutronClientException): message = _("Unauthorized: bad credentials.") diff --git a/neutronclient/v2_0/client.py b/neutronclient/v2_0/client.py index cc8f7056a..0e7fd5690 100644 --- a/neutronclient/v2_0/client.py +++ b/neutronclient/v2_0/client.py @@ -51,7 +51,9 @@ def exception_handler_v20(status_code, error_content): 'PortInUse': exceptions.PortInUseClient, 'AlreadyAttached': exceptions.AlreadyAttachedClient, 'IpAddressGenerationFailure': - exceptions.IpAddressGenerationFailureClient, } + exceptions.IpAddressGenerationFailureClient, + 'ExternalIpAddressExhausted': + exceptions.ExternalIpAddressExhaustedClient, } error_dict = None if isinstance(error_content, dict):