From d2db9790dd1c2f7a955236e01e37b579a2c87321 Mon Sep 17 00:00:00 2001 From: Brian Waldon Date: Thu, 10 Nov 2011 23:20:52 -0500 Subject: Converting lock/unlock to use instance objects Related to blueprint internal-uuids Change-Id: I5a7842953da64cd2a060e5e384d06cdf535c7a1f --- nova/api/openstack/contrib/admin_actions.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'nova/api') 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) -- cgit