diff --git a/neutronclient/common/exceptions.py b/neutronclient/common/exceptions.py index 4298d423a..1040ee120 100644 --- a/neutronclient/common/exceptions.py +++ b/neutronclient/common/exceptions.py @@ -162,6 +162,10 @@ class IpAddressInUseClient(Conflict): pass +class IpAddressAlreadyAllocatedClient(Conflict): + pass + + class InvalidIpForNetworkClient(BadRequest): pass diff --git a/neutronclient/tests/unit/test_cli20.py b/neutronclient/tests/unit/test_cli20.py index 132e1e547..0837a6c3d 100644 --- a/neutronclient/tests/unit/test_cli20.py +++ b/neutronclient/tests/unit/test_cli20.py @@ -911,6 +911,8 @@ class CLITestV20ExceptionHandler(CLITestV20Base): ('OverQuota', exceptions.OverQuotaClient, 409), ('InvalidIpForNetwork', exceptions.InvalidIpForNetworkClient, 400), ('InvalidIpForSubnet', exceptions.InvalidIpForSubnetClient, 400), + ('IpAddressAlreadyAllocated', + exceptions.IpAddressAlreadyAllocatedClient, 400), ] error_msg = 'dummy exception message' diff --git a/releasenotes/notes/Define-IpAddressAlreadyAllocatedClient-exception-e8600ca5ba1c7f45.yaml b/releasenotes/notes/Define-IpAddressAlreadyAllocatedClient-exception-e8600ca5ba1c7f45.yaml new file mode 100644 index 000000000..4182585e0 --- /dev/null +++ b/releasenotes/notes/Define-IpAddressAlreadyAllocatedClient-exception-e8600ca5ba1c7f45.yaml @@ -0,0 +1,6 @@ +--- +other: + - | + Define a new exception type ``IpAddressAlreadyAllocatedClient``. + Users can catch this specific exception instead of the generic + ``NeutronClientException``.