Merge "Add host to get_backdoor_port() for network api."

This commit is contained in:
Jenkins 2012-12-05 16:57:15 +00:00 committed by Gerrit Code Review
commit f9245c8353
5 changed files with 13 additions and 9 deletions

@ -123,8 +123,8 @@ class API(base.Base):
return self.network_rpcapi.get_floating_ips_by_fixed_address(context,
fixed_address)
def get_backdoor_port(self, context):
return self.network_rpcapi.get_backdoor_port(context)
def get_backdoor_port(self, context, host):
return self.network_rpcapi.get_backdoor_port(context, host)
def get_instance_id_by_floating_address(self, context, address):
# NOTE(tr3buchet): i hate this

@ -876,7 +876,7 @@ class NetworkManager(manager.SchedulerDependentManager):
The one at a time part is to flatten the layout to help scale
"""
RPC_API_VERSION = '1.3'
RPC_API_VERSION = '1.4'
# If True, this manager requires VIF to create a bridge.
SHOULD_CREATE_BRIDGE = False

@ -36,6 +36,7 @@ class NetworkAPI(rpc_proxy.RpcProxy):
1.1 - Adds migrate_instance_[start|finish]
1.2 - Make migrate_instance_[start|finish] a little more flexible
1.3 - Adds fanout cast update_dns for multi_host networks
1.4 - Add get_backdoor_port()
'''
#
@ -105,8 +106,10 @@ class NetworkAPI(rpc_proxy.RpcProxy):
'get_instance_id_by_floating_address',
address=address))
def get_backdoor_port(self, ctxt):
return self.call(ctxt, self.make_msg('get_backdoor_port'))
def get_backdoor_port(self, ctxt, host):
return self.call(ctxt, self.make_msg('get_backdoor_port'),
topic=rpc.queue_get_for(ctxt, self.topic, host),
version='1.4')
def get_vifs_by_instance(self, ctxt, instance_id):
# NOTE(vish): When the db calls are converted to store network

@ -202,11 +202,11 @@ class ApiTestCase(test.TestCase):
def test_get_backdoor_port(self):
backdoor_port = 59697
def fake_get_backdoor_port(ctxt):
def fake_get_backdoor_port(ctxt, host):
return backdoor_port
self.stubs.Set(self.network_api.network_rpcapi, 'get_backdoor_port',
fake_get_backdoor_port)
port = self.network_api.get_backdoor_port(self.context)
port = self.network_api.get_backdoor_port(self.context, 'fake_host')
self.assertEqual(port, backdoor_port)

@ -46,7 +46,7 @@ class NetworkRpcAPITestCase(test.TestCase):
'_rpc_allocate_fixed_ip', 'deallocate_fixed_ip', 'update_dns',
'_associate_floating_ip', '_disassociate_floating_ip',
'lease_fixed_ip', 'release_fixed_ip', 'migrate_instance_start',
'migrate_instance_finish',
'migrate_instance_finish', 'get_backdoor_port'
]
if method in targeted_methods and 'host' in kwargs:
if method != 'deallocate_fixed_ip':
@ -122,7 +122,8 @@ class NetworkRpcAPITestCase(test.TestCase):
rpc_method='call', address='w.x.y.z')
def test_get_backdoor_port(self):
self._test_network_api('get_backdoor_port', rpc_method='call')
self._test_network_api('get_backdoor_port', rpc_method='call',
host='fake_host', version='1.4')
def test_get_vifs_by_instance(self):
self._test_network_api('get_vifs_by_instance',