Skip to content

Commit

Permalink
Add get_console_topic() to the compute rpcapi.
Browse files Browse the repository at this point in the history
Part of bug 1006467.

This patch adds get_console_topic to the compute rpcapi.  This method is
used by the console API.

Change-Id: I738be88a52fede0739a73283b6e2640072f0f72b
  • Loading branch information
russellb committed May 31, 2012
1 parent ebedbfd commit 60b6c5d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions nova/compute/rpcapi.py
Expand Up @@ -118,6 +118,10 @@ def get_console_pool_info(self, ctxt, console_type, host):
console_type=console_type),
topic=self._compute_topic(ctxt, host, None))

def get_console_topic(self, ctxt, host):
return self.call(ctxt, self.make_msg('get_console_topic'),
topic=self._compute_topic(ctxt, host, None))

def get_diagnostics(self, ctxt, instance):
return self.call(ctxt, self.make_msg('get_diagnostics',
instance_uuid=instance['uuid']),
Expand Down
8 changes: 3 additions & 5 deletions nova/console/api.py
Expand Up @@ -17,6 +17,7 @@

"""Handles ConsoleProxy API requests."""

from nova.compute import rpcapi as compute_rpcapi
from nova.console import rpcapi as console_rpcapi
from nova.db import base
from nova import flags
Expand Down Expand Up @@ -61,11 +62,8 @@ def create_console(self, context, instance_id):
rpcapi.add_console(context, instance['id'])

def _get_console_topic(self, context, instance_host):
topic = rpc.queue_get_for(context,
FLAGS.compute_topic,
instance_host)
return rpc.call(context, topic, {'method': 'get_console_topic',
'args': {'fake': 1}})
rpcapi = compute_rpcapi.ComputeAPI()
return rpcapi.get_console_topic(context, instance_host)

def _translate_uuid_if_necessary(self, context, instance_id):
if utils.is_uuid_like(instance_id):
Expand Down
3 changes: 3 additions & 0 deletions nova/tests/compute/test_rpcapi.py
Expand Up @@ -134,6 +134,9 @@ def test_get_console_pool_info(self):
self._test_compute_api('get_console_pool_info', 'call',
console_type='type', host='host')

def test_get_console_topic(self):
self._test_compute_api('get_console_topic', 'call', host='host')

def test_get_diagnostics(self):
self._test_compute_api('get_diagnostics', 'call',
instance=self.fake_instance)
Expand Down

0 comments on commit 60b6c5d

Please sign in to comment.