summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/v2/servers.py4
1 files changed, 4 insertions, 0 deletions
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: