From 04c9bd5df483256695be6f551d551f6cfc51daa2 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 19 Dec 2012 17:03:14 -0500 Subject: [PATCH] Add get_backdoor_port to scheduler. This adds a get_backdoor_port function to the scheduler service which enables returning the eventlet_backdoor port from rpc for the service. Change-Id: Ib88e2a9e709d5240722027c94e6762b4a3bd918c --- nova/scheduler/rpcapi.py | 5 +++++ nova/tests/scheduler/test_rpcapi.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/nova/scheduler/rpcapi.py b/nova/scheduler/rpcapi.py index 4bc6e0e4..6ae4adca 100644 --- a/nova/scheduler/rpcapi.py +++ b/nova/scheduler/rpcapi.py @@ -49,6 +49,7 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy): 2.3 - Remove create_volume() 2.4 - Change update_service_capabilities() - accepts a list of capabilities + 2.5 - Add get_backdoor_port() ''' # @@ -106,3 +107,7 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy): service_name=service_name, host=host, capabilities=capabilities), version='2.4') + + def get_backdoor_port(self, context, host): + return self.call(context, self.make_msg('get_backdoor_port'), + version='2.5') diff --git a/nova/tests/scheduler/test_rpcapi.py b/nova/tests/scheduler/test_rpcapi.py index b1174559..da7652a5 100644 --- a/nova/tests/scheduler/test_rpcapi.py +++ b/nova/tests/scheduler/test_rpcapi.py @@ -37,6 +37,9 @@ class SchedulerRpcAPITestCase(test.TestCase): expected_msg = rpcapi.make_msg(method, **kwargs) expected_msg['version'] = expected_version + if method == 'get_backdoor_port': + del expected_msg['args']['host'] + self.fake_args = None self.fake_kwargs = None @@ -84,3 +87,7 @@ class SchedulerRpcAPITestCase(test.TestCase): rpc_method='fanout_cast', service_name='fake_name', host='fake_host', capabilities='fake_capabilities', version='2.4') + + def test_get_backdoor_port(self): + self._test_scheduler_api('get_backdoor_port', rpc_method='call', + host='fake_host', version='2.5')