Add get_console_pool_info() to the compute rpcapi.
Part of bug 1006467. This patch adds the get_console_pool_info() method to the compute rpcapi. This is used by the console manager. Change-Id: I429123ed48cb2a5fcfb70248eac743cf4e7a76f2
This commit is contained in:
@@ -101,6 +101,11 @@ class ComputeAPI(nova.rpc.proxy.RpcProxy):
|
||||
instance_uuid=instance['uuid'], tail_length=tail_length),
|
||||
topic=self._compute_topic(ctxt, None, instance))
|
||||
|
||||
def get_console_pool_info(self, ctxt, console_type, host):
|
||||
return self.call(ctxt, self.make_msg('get_console_pool_info',
|
||||
console_type=console_type),
|
||||
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']),
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
import socket
|
||||
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova import manager
|
||||
from nova.openstack.common import cfg
|
||||
from nova.openstack.common import importutils
|
||||
from nova import rpc
|
||||
from nova import utils
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ class ConsoleProxyManager(manager.Manager):
|
||||
self.driver = importutils.import_object(console_driver)
|
||||
super(ConsoleProxyManager, self).__init__(*args, **kwargs)
|
||||
self.driver.host = self.host
|
||||
self.compute_rpcapi = compute_rpcapi.ComputeAPI()
|
||||
|
||||
def init_host(self):
|
||||
self.driver.init_host()
|
||||
@@ -121,12 +122,8 @@ class ConsoleProxyManager(manager.Manager):
|
||||
'username': 'test',
|
||||
'password': '1234pass'}
|
||||
else:
|
||||
pool_info = rpc.call(context,
|
||||
rpc.queue_get_for(context,
|
||||
FLAGS.compute_topic,
|
||||
instance_host),
|
||||
{'method': 'get_console_pool_info',
|
||||
'args': {'console_type': console_type}})
|
||||
pool_info = compute_rpcapi.get_console_pool_info(context,
|
||||
console_type, instance_host)
|
||||
pool_info['password'] = self.driver.fix_pool_password(
|
||||
pool_info['password'])
|
||||
pool_info['host'] = self.host
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
"""VMRC Console Manager."""
|
||||
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
from nova import exception
|
||||
from nova import flags
|
||||
from nova import log as logging
|
||||
from nova import manager
|
||||
from nova.openstack.common import cfg
|
||||
from nova.openstack.common import importutils
|
||||
from nova import rpc
|
||||
from nova.virt import vmwareapi_conn
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ class ConsoleVMRCManager(manager.Manager):
|
||||
|
||||
def __init__(self, console_driver=None, *args, **kwargs):
|
||||
self.driver = importutils.import_object(FLAGS.console_driver)
|
||||
self.compute_rpcapi = compute_rpcapi.ComputeAPI()
|
||||
super(ConsoleVMRCManager, self).__init__(*args, **kwargs)
|
||||
|
||||
def init_host(self):
|
||||
@@ -137,12 +138,8 @@ class ConsoleVMRCManager(manager.Manager):
|
||||
self.host,
|
||||
console_type)
|
||||
except exception.NotFound:
|
||||
pool_info = rpc.call(context,
|
||||
rpc.queue_get_for(context,
|
||||
FLAGS.compute_topic,
|
||||
instance_host),
|
||||
{'method': 'get_console_pool_info',
|
||||
'args': {'console_type': console_type}})
|
||||
pool_info = self.compute_rpcapi.get_console_pool_info(context,
|
||||
console_type, instance_host)
|
||||
pool_info['password'] = self.driver.fix_pool_password(
|
||||
pool_info['password'])
|
||||
pool_info['host'] = self.host
|
||||
|
||||
@@ -108,6 +108,10 @@ class ComputeRpcAPITestCase(test.TestCase):
|
||||
self._test_compute_api('get_console_output', 'call',
|
||||
instance=self.fake_instance, tail_length='tl')
|
||||
|
||||
def test_get_console_pool_info(self):
|
||||
self._test_compute_api('get_console_pool_info', 'call',
|
||||
console_type='type', host='host')
|
||||
|
||||
def test_get_diagnostics(self):
|
||||
self._test_compute_api('get_diagnostics', 'call',
|
||||
instance=self.fake_instance)
|
||||
|
||||
Reference in New Issue
Block a user