From aa8a6a01bdf8a2f0f732e993a1732993f7328eff Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Wed, 22 Dec 2010 13:00:20 -0800 Subject: add in support of openstack api --- nova/compute/api.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index c740814da..1acf320ae 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -316,6 +316,30 @@ class ComputeAPI(base.Base): {"method": "unrescue_instance", "args": {"instance_id": instance['id']}}) + def get_ajax_console(self, context, instance_id): + """Get an AJAX Console + + In order for this to work properly, a ttyS0 must be configured + in the instance + """ + + instance_ref = db.instance_get_by_internal_id(context, instance_id) + + output = rpc.call(context, + '%s.%s' % (FLAGS.compute_topic, + instance_ref['host']), + {'method': 'get_ajax_console', + 'args': {'instance_id': instance_ref['id']}}) + + # TODO: make this a call + rpc.cast(context, '%s' % FLAGS.ajax_console_proxy_topic, + {'method': 'authorize_ajax_console', + 'args': {'token': output['token'], 'host': output['host'], + 'port':output['port']}}) + + return {'url': '%s?token=%s' % (FLAGS.ajax_console_proxy_url, + output['token'])} + def _get_network_topic(self, context): """Retrieves the network host for a project""" network_ref = self.network_manager.get_network(context) -- cgit