summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorPhilip Knouff <philip.knouff@mailtrust.com>2012-03-05 19:41:12 +0000
committerPhilip Knouff <philip.knouff@mailtrust.com>2012-03-05 19:42:32 +0000
commit913ecb84d286413cfec3dff7cf1b1b71f93bcfce (patch)
tree191e55a1066e2b6c07402754d056edac3c763e65 /nova/api
parent84dc739b289a81848134184f8bfadfe69835feee (diff)
downloadnova-913ecb84d286413cfec3dff7cf1b1b71f93bcfce.tar.gz
nova-913ecb84d286413cfec3dff7cf1b1b71f93bcfce.tar.xz
nova-913ecb84d286413cfec3dff7cf1b1b71f93bcfce.zip
Raise 409 when rescuing instance in RESCUE mode
fixes bud #940581 Change-Id: I8c6b600d36a35ef4e32f35b888f8f2eb8effebcd
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/rescue.py8
-rw-r--r--nova/api/openstack/extensions.py2
2 files changed, 9 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/contrib/rescue.py b/nova/api/openstack/compute/contrib/rescue.py
index bd2d09162..20158ff22 100644
--- a/nova/api/openstack/compute/contrib/rescue.py
+++ b/nova/api/openstack/compute/contrib/rescue.py
@@ -17,6 +17,7 @@
import webob
from webob import exc
+from nova.api.openstack import common
from nova.api.openstack import extensions as exts
from nova.api.openstack import wsgi
from nova import compute
@@ -56,7 +57,12 @@ class RescueController(wsgi.Controller):
password = utils.generate_password(FLAGS.password_length)
instance = self._get_instance(context, id)
- self.compute_api.rescue(context, instance, rescue_password=password)
+ try:
+ self.compute_api.rescue(context, instance,
+ rescue_password=password)
+ except exception.InstanceInvalidState as state_error:
+ common.raise_http_conflict_for_instance_invalid_state(state_error,
+ 'rescue')
return {'adminPass': password}
@wsgi.action('unrescue')
diff --git a/nova/api/openstack/extensions.py b/nova/api/openstack/extensions.py
index 7d4a167dd..87d215974 100644
--- a/nova/api/openstack/extensions.py
+++ b/nova/api/openstack/extensions.py
@@ -301,6 +301,8 @@ def wrap_errors(fn):
def wrapped(*args, **kwargs):
try:
return fn(*args, **kwargs)
+ except webob.exc.HTTPException:
+ raise
except Exception:
raise webob.exc.HTTPInternalServerError()
return wrapped