Add host to get_backdoor_port() for network api.

get_backdoor_port() in the network api doesn't have
a host parameter. However, if there are more than one
network service running on multiple hosts then you will
only be able to get the backdoor port for one of those
services. So the host field is needed to target the rpc
call.
Also, the RPC_API_VERSION number was incremented because this was
overlooked in change id: I95fdb5ca9bce9f3128300e3b5601fb2b2fc5e82f
Change-Id: I90357548c0483559982469b7c26d40511755924e
This commit is contained in:
Matthew Treinish
2012年12月04日 11:10:51 -05:00
parent f354276930
commit a7551a20b2

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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',
Reference in New Issue
openstack/nova
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.

The note is not visible to the blocked user.