summaryrefslogtreecommitdiffstats
path: root/nova/exception.py
diff options
context:
space:
mode:
authorHaiwei Xu <xu-haiwei@mxw.nes.nec.co.jp>2013-04-01 16:48:56 +0900
committerHaiwei Xu <xu-haiwei@mxw.nes.nec.co.jp>2013-04-01 16:55:15 +0900
commit8a80c4c0968a9deceaa6d99629c6d7f7889769e5 (patch)
tree9869476155c801a0de8998fd6bc2959ebd13e959 /nova/exception.py
parenta831e9d2608aa9fd6200ea873e3cb766322a6c3c (diff)
downloadnova-8a80c4c0968a9deceaa6d99629c6d7f7889769e5.tar.gz
nova-8a80c4c0968a9deceaa6d99629c6d7f7889769e5.tar.xz
nova-8a80c4c0968a9deceaa6d99629c6d7f7889769e5.zip
Return proper error message when network conflicts
Fixes bug 1158075 When creating a network which is already existing, we got an internal server error which can't show the error reason. This patch returns conflict error(HTTP 409) instead of internal server error(HTTP 500), so that users can know the error reason from the error message. Change-Id: I9e39a7152e37756b34b1c8d77de057012743f0f7
Diffstat (limited to 'nova/exception.py')
-rw-r--r--nova/exception.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nova/exception.py b/nova/exception.py
index 43f02b7cb..b3b3d1f1f 100644
--- a/nova/exception.py
+++ b/nova/exception.py
@@ -1083,6 +1083,11 @@ class DuplicateVlan(Duplicate):
message = _("Detected existing vlan with id %(vlan)d")
+class CidrConflict(NovaException):
+ message = _("There was a conflict when trying to complete your request.")
+ code = 409
+
+
class InstanceNotFound(NotFound):
message = _("Instance %(instance_id)s could not be found.")