diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2010-12-22 13:00:20 -0800 |
|---|---|---|
| committer | Anthony Young <sleepsonthefloor@gmail.com> | 2010-12-22 13:00:20 -0800 |
| commit | aa8a6a01bdf8a2f0f732e993a1732993f7328eff (patch) | |
| tree | be9f32236d001f44afd3439a29b6133460f46147 /nova/api | |
| parent | 19f389b3dcc89f0115dc6fc1a6ca606338ad866a (diff) | |
| download | nova-aa8a6a01bdf8a2f0f732e993a1732993f7328eff.tar.gz nova-aa8a6a01bdf8a2f0f732e993a1732993f7328eff.tar.xz nova-aa8a6a01bdf8a2f0f732e993a1732993f7328eff.zip | |
add in support of openstack api
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/cloud.py | 23 | ||||
| -rw-r--r-- | nova/api/openstack/servers.py | 9 |
2 files changed, 10 insertions, 22 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py index b3aa83398..11853c8db 100644 --- a/nova/api/ec2/cloud.py +++ b/nova/api/ec2/cloud.py @@ -452,30 +452,9 @@ class CloudController(object): "output": base64.b64encode(output)} def get_ajax_console(self, context, instance_id, **kwargs): - """Get an AJAX Console - - In order for this to work properly, a ttyS0 must be configured - in the instance - """ - ec2_id = instance_id[0] internal_id = ec2_id_to_internal_id(ec2_id) - instance_ref = db.instance_get_by_internal_id(context, internal_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'])} + return self.compute_api.get_ajax_console(context, internal_id) def describe_volumes(self, context, volume_id=None, **kwargs): if context.user.is_admin(): diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index 5c3322f7c..45db89cbf 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -195,3 +195,12 @@ class Controller(wsgi.Controller): logging.error("Compute.api::unpause %s", readable) return faults.Fault(exc.HTTPUnprocessableEntity()) return exc.HTTPAccepted() + + def get_ajax_console(self, req, id): + """ Returns a url to and ajaxterm instance console. """ + try: + self.compute_api.get_ajax_console(req.environ['nova.context'], + int(id)) + except exception.NotFound: + return faults.Fault(exc.HTTPNotFound()) + return exc.HTTPAccepted() |
