summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-17 12:14:24 +0000
committerGerrit Code Review <review@openstack.org>2013-01-17 12:14:24 +0000
commit921b7c514fb79bd4b8a023f34d22df4efe5406ad (patch)
tree4cdb3c0036cb711fe86b2b3a1acf8e72629bd124 /nova/api
parent9ae14c7570bb9dfc4bf1ab8f8127cae3c9eb2641 (diff)
parent518bdb5abaab6ae11e18bebaf4d279197f21522f (diff)
downloadnova-921b7c514fb79bd4b8a023f34d22df4efe5406ad.tar.gz
nova-921b7c514fb79bd4b8a023f34d22df4efe5406ad.tar.xz
nova-921b7c514fb79bd4b8a023f34d22df4efe5406ad.zip
Merge "Expose a get_spice_console RPC API method"
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/consoles.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/contrib/consoles.py b/nova/api/openstack/compute/contrib/consoles.py
index 4f88d033c..4895a9e7b 100644
--- a/nova/api/openstack/compute/contrib/consoles.py
+++ b/nova/api/openstack/compute/contrib/consoles.py
@@ -53,10 +53,33 @@ class ConsolesController(wsgi.Controller):
return {'console': {'type': console_type, 'url': output['url']}}
+ @wsgi.action('os-getSPICEConsole')
+ def get_spice_console(self, req, id, body):
+ """Get text console output."""
+ context = req.environ['nova.context']
+ authorize(context)
+
+ # If type is not supplied or unknown, get_spice_console below will cope
+ console_type = body['os-getSPICEConsole'].get('type')
+
+ try:
+ instance = self.compute_api.get(context, id)
+ output = self.compute_api.get_spice_console(context,
+ instance,
+ console_type)
+ except exception.InstanceNotFound as e:
+ raise webob.exc.HTTPNotFound(explanation=unicode(e))
+ except exception.InstanceNotReady as e:
+ raise webob.exc.HTTPConflict(explanation=unicode(e))
+
+ return {'console': {'type': console_type, 'url': output['url']}}
+
def get_actions(self):
"""Return the actions the extension adds, as required by contract."""
actions = [extensions.ActionExtension("servers", "os-getVNCConsole",
- self.get_vnc_console)]
+ self.get_vnc_console),
+ extensions.ActionExtension("servers", "os-getSPICEConsole",
+ self.get_spice_console)]
return actions