From 575ad8f77dc7095c8a0ba9dd8deb41bf2fddae1f Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Mon, 26 Mar 2012 20:43:43 +0000 Subject: Fix unrescue in invalid state Fixes bug 965667 Unrescue did not check for InstanceInvalidState exception and return the appropriate error. Change-Id: I3ca2c1dae09bd149086bfe67e2233c8359d5c8f8 --- nova/api/openstack/compute/contrib/rescue.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/rescue.py b/nova/api/openstack/compute/contrib/rescue.py index b46b12a18..7bf815a37 100644 --- a/nova/api/openstack/compute/contrib/rescue.py +++ b/nova/api/openstack/compute/contrib/rescue.py @@ -72,7 +72,11 @@ class RescueController(wsgi.Controller): context = req.environ["nova.context"] authorize(context) instance = self._get_instance(context, id) - self.compute_api.unrescue(context, instance) + try: + self.compute_api.unrescue(context, instance) + except exception.InstanceInvalidState as state_error: + common.raise_http_conflict_for_instance_invalid_state(state_error, + 'unrescue') return webob.Response(status_int=202) -- cgit