From 18f72f29a92733e56d8641e48b2099df1b8b30f4 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Wed, 4 Jan 2012 18:54:45 -0500 Subject: Return 409s instead of 500s when deleting certain instances. Fixes bug 911879 Change-Id: Ib2ae875ec2d1eeea21d15a756b96c27047b12bee --- nova/api/openstack/v2/servers.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/api') diff --git a/nova/api/openstack/v2/servers.py b/nova/api/openstack/v2/servers.py index d98d532dc..bab2976f9 100644 --- a/nova/api/openstack/v2/servers.py +++ b/nova/api/openstack/v2/servers.py @@ -575,6 +575,10 @@ class Controller(wsgi.Controller): self._delete(req.environ['nova.context'], id) except exception.NotFound: raise exc.HTTPNotFound() + except exception.InstanceInvalidState as state_error: + state = state_error.kwargs.get("state") + msg = _("Unable to delete instance when %s") % state + raise exc.HTTPConflict(explanation=msg) def _get_key_name(self, req, body): if 'server' in body: -- cgit