diff options
| author | Ed Leafe <ed@leafe.com> | 2011-01-07 07:28:30 -0600 |
|---|---|---|
| committer | Ed Leafe <ed@leafe.com> | 2011-01-07 07:28:30 -0600 |
| commit | b024dcf6f0c1e5a2735e84d21d6edef5ff38d1cf (patch) | |
| tree | 72a98ad437b83e6f24e0848739f5502c52dacdae /nova/api | |
| parent | e66f3017373dcf9135c53ae4d510b0b2a5dcecf0 (diff) | |
| parent | e33102d23ec8f357c08e2583f8d9e3c1753bab4d (diff) | |
| download | nova-b024dcf6f0c1e5a2735e84d21d6edef5ff38d1cf.tar.gz nova-b024dcf6f0c1e5a2735e84d21d6edef5ff38d1cf.tar.xz nova-b024dcf6f0c1e5a2735e84d21d6edef5ff38d1cf.zip | |
merged changes from trunk
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/servers.py | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index bc89f696c..a426a721d 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -180,6 +180,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'] @@ -232,4 +276,13 @@ class Controller(wsgi.Controller): def actions(self, req, id): """Permit Admins to retrieve server actions.""" ctxt = req.environ["nova.context"] - return self.compute_api.get_actions(ctxt, id_val) + items = self.compute_api.get_actions(ctxt, id) + actions = [] + # TODO(jk0): Do not do pre-serialization here once the default + # serializer is updated + for item in items: + actions.append(dict( + created_at=str(item.created_at), + action=item.action, + error=item.error)) + return dict(actions=actions) |
