summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/contrib/admin_actions.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/nova/api/openstack/contrib/admin_actions.py b/nova/api/openstack/contrib/admin_actions.py
index 5e0c8571f..81b23a8a0 100644
--- a/nova/api/openstack/contrib/admin_actions.py
+++ b/nova/api/openstack/contrib/admin_actions.py
@@ -156,7 +156,10 @@ class Admin_actions(extensions.ExtensionDescriptor):
"""Permit admins to lock a server"""
context = req.environ['nova.context']
try:
- self.compute_api.lock(context, id)
+ instance = self.compute_api.get(context, id)
+ self.compute_api.lock(context, instance)
+ except exception.InstanceNotFound:
+ raise exc.HTTPNotFound(_("Server not found"))
except Exception:
readable = traceback.format_exc()
LOG.exception(_("Compute.api::lock %s"), readable)
@@ -170,7 +173,10 @@ class Admin_actions(extensions.ExtensionDescriptor):
"""Permit admins to lock a server"""
context = req.environ['nova.context']
try:
- self.compute_api.unlock(context, id)
+ instance = self.compute_api.get(context, id)
+ self.compute_api.unlock(context, instance)
+ except exception.InstanceNotFound:
+ raise exc.HTTPNotFound(_("Server not found"))
except Exception:
readable = traceback.format_exc()
LOG.exception(_("Compute.api::unlock %s"), readable)