From cbdd56da309ab0b610ed1f383f11bea26fa7b8c0 Mon Sep 17 00:00:00 2001 From: jichenjc <jichenjc@cn.ibm.com> Date: Tue, 22 Apr 2014 14:20:02 +0800 Subject: [PATCH] Add OverQuotaClient as exception to neutronclient In nova, there is no way to explictly knows whether the neutron fails due to over quota or no more floating ips and fixed ips. so nova need to check whether the return value is 409 in order to raise an over quota exception. It's easier in neutronclient to raise the exception then nova will handle it. Related-Bug: #1210598 Change-Id: I8788993578ac872da9f676fe3e2fb8f98414289d --- neutronclient/common/exceptions.py | 4 ++++ neutronclient/tests/unit/test_cli20.py | 1 + 2 files changed, 5 insertions(+) diff --git a/neutronclient/common/exceptions.py b/neutronclient/common/exceptions.py index f4085d319..65f1c26e4 100644 --- a/neutronclient/common/exceptions.py +++ b/neutronclient/common/exceptions.py @@ -139,6 +139,10 @@ class IpAddressInUseClient(Conflict): pass +class OverQuotaClient(Conflict): + pass + + # TODO(amotoki): It is unused in Neutron, but it is referred to # in Horizon code. After Horizon code is updated, remove it. class AlreadyAttachedClient(Conflict): diff --git a/neutronclient/tests/unit/test_cli20.py b/neutronclient/tests/unit/test_cli20.py index 51ff0bf00..e49605d3e 100644 --- a/neutronclient/tests/unit/test_cli20.py +++ b/neutronclient/tests/unit/test_cli20.py @@ -591,6 +591,7 @@ class CLITestV20ExceptionHandler(CLITestV20Base): exceptions.IpAddressGenerationFailureClient, 409), ('ExternalIpAddressExhausted', exceptions.ExternalIpAddressExhaustedClient, 400), + ('OverQuota', exceptions.OverQuotaClient, 409), ] error_msg = 'dummy exception message'