Add get_backdoor_port to consoleauth.
This adds a get_backdoor_port function to the consoleauth service which enables returning the eventlet_backdoor port from rpc for the service. Change-Id: I7da9cbc8111342b5f49f148a8e3389faf5c4f2ab
This commit is contained in:
parent
5fa80467c2
commit
79d919bc87
@ -45,7 +45,7 @@ CONF.import_opt('memcached_servers', 'nova.config')
|
||||
class ConsoleAuthManager(manager.Manager):
|
||||
"""Manages token based authentication."""
|
||||
|
||||
RPC_API_VERSION = '1.0'
|
||||
RPC_API_VERSION = '1.1'
|
||||
|
||||
def __init__(self, scheduler_driver=None, *args, **kwargs):
|
||||
super(ConsoleAuthManager, self).__init__(*args, **kwargs)
|
||||
@ -75,3 +75,6 @@ class ConsoleAuthManager(manager.Manager):
|
||||
LOG.audit(_("Checking Token: %(token)s, %(token_valid)s)"), locals())
|
||||
if token_valid:
|
||||
return jsonutils.loads(token_str)
|
||||
|
||||
def get_backdoor_port(self, context):
|
||||
return self.backdoor_port
|
||||
|
@ -30,6 +30,7 @@ class ConsoleAuthAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
||||
API version history:
|
||||
|
||||
1.0 - Initial version.
|
||||
1.1 - Added get_backdoor_port()
|
||||
'''
|
||||
|
||||
#
|
||||
@ -59,3 +60,7 @@ class ConsoleAuthAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
||||
|
||||
def check_token(self, ctxt, token):
|
||||
return self.call(ctxt, self.make_msg('check_token', token=token))
|
||||
|
||||
def get_backdoor_port(self, ctxt, host):
|
||||
return self.call(ctxt, self.make_msg('get_backdoor_port'),
|
||||
version='1.1')
|
||||
|
@ -49,3 +49,8 @@ class ConsoleauthTestCase(test.TestCase):
|
||||
self.assertTrue(self.manager.check_token(self.context, token))
|
||||
timeutils.advance_time_seconds(1)
|
||||
self.assertFalse(self.manager.check_token(self.context, token))
|
||||
|
||||
def test_get_backdoor_port(self):
|
||||
self.manager.backdoor_port = 59697
|
||||
port = self.manager.get_backdoor_port(self.context)
|
||||
self.assertEqual(port, self.manager.backdoor_port)
|
||||
|
@ -18,6 +18,7 @@
|
||||
Unit Tests for nova.consoleauth.rpcapi
|
||||
"""
|
||||
|
||||
from nova.consoleauth import manager as consoleauth_manager
|
||||
from nova.consoleauth import rpcapi as consoleauth_rpcapi
|
||||
from nova import context
|
||||
from nova.openstack.common import cfg
|
||||
@ -32,8 +33,12 @@ class ConsoleAuthRpcAPITestCase(test.TestCase):
|
||||
ctxt = context.RequestContext('fake_user', 'fake_project')
|
||||
rpcapi = consoleauth_rpcapi.ConsoleAuthAPI()
|
||||
expected_retval = 'foo'
|
||||
expected_version = kwargs.pop('version', rpcapi.BASE_RPC_API_VERSION)
|
||||
expected_msg = rpcapi.make_msg(method, **kwargs)
|
||||
expected_msg['version'] = rpcapi.BASE_RPC_API_VERSION
|
||||
expected_msg['version'] = expected_version
|
||||
|
||||
if method == 'get_backdoor_port':
|
||||
del expected_msg['args']['host']
|
||||
|
||||
self.call_ctxt = None
|
||||
self.call_topic = None
|
||||
@ -64,3 +69,7 @@ class ConsoleAuthRpcAPITestCase(test.TestCase):
|
||||
|
||||
def test_check_token(self):
|
||||
self._test_consoleauth_api('check_token', token='t')
|
||||
|
||||
def test_get_backdoor_port(self):
|
||||
self._test_consoleauth_api('get_backdoor_port', host='fake_host',
|
||||
version='1.1')
|
||||
|
Loading…
x
Reference in New Issue
Block a user