diff options
| author | Trey Morris <trey.morris@rackspace.com> | 2011-01-07 00:49:30 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-01-07 00:49:30 +0000 |
| commit | ae5dbe2b5d4871d3e26e859c03feab705c9c59ea (patch) | |
| tree | 1f4d91ad0bf11c6387bf49399ee5768ff1eb8902 /nova/api | |
| parent | 9eca4d51f55b078942c9886fd5b785d6f045c6d2 (diff) | |
| parent | 76e3923c40dff2f754b045847d8ad19ea9a7cef1 (diff) | |
| download | nova-ae5dbe2b5d4871d3e26e859c03feab705c9c59ea.tar.gz nova-ae5dbe2b5d4871d3e26e859c03feab705c9c59ea.tar.xz nova-ae5dbe2b5d4871d3e26e859c03feab705c9c59ea.zip | |
This branch implements lock functionality. The lock is stored in the compute worker database. Decorators have been added to the openstack API actions which alter instances in any way.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/servers.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index ce64ac7ad..f8d5e7685 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -170,6 +170,50 @@ class Controller(wsgi.Controller): return faults.Fault(exc.HTTPUnprocessableEntity()) return exc.HTTPAccepted() + def lock(self, req, id): + """ + lock the instance with id + admin only operation + + """ + context = req.environ['nova.context'] + try: + self.compute_api.lock(context, id) + except: + readable = traceback.format_exc() + logging.error(_("Compute.api::lock %s"), readable) + return faults.Fault(exc.HTTPUnprocessableEntity()) + return exc.HTTPAccepted() + + def unlock(self, req, id): + """ + unlock the instance with id + admin only operation + + """ + context = req.environ['nova.context'] + try: + self.compute_api.unlock(context, id) + except: + readable = traceback.format_exc() + logging.error(_("Compute.api::unlock %s"), readable) + return faults.Fault(exc.HTTPUnprocessableEntity()) + return exc.HTTPAccepted() + + def get_lock(self, req, id): + """ + return the boolean state of (instance with id)'s lock + + """ + context = req.environ['nova.context'] + try: + self.compute_api.get_lock(context, id) + except: + readable = traceback.format_exc() + logging.error(_("Compute.api::get_lock %s"), readable) + return faults.Fault(exc.HTTPUnprocessableEntity()) + return exc.HTTPAccepted() + def pause(self, req, id): """ Permit Admins to Pause the server. """ ctxt = req.environ['nova.context'] |
