Pass host parameter to the get_network_info method
Host parameter is needed there to filter subnets per segment when segments plugin is enabled. When dhcp agent requests informations about networks, and segments plugin is enabled, subnets which belongs to the network are filtered out based on the host passed as argument to the get_network_info() method. But we never passed host to that method, even when we should e.g. during the full sync of the DHCP agent, when it requests details about each network. This patch fixes that issue by passing host parameter to that method. Closes-Bug: #1958955 Change-Id: Ib5eef501493f6735a47ea085196242a5807c4565
This commit is contained in:
parent
30951fcdfa
commit
8fd88fd223
@ -167,7 +167,7 @@ class DhcpRpcCallback(object):
|
||||
ret = []
|
||||
for network in networks:
|
||||
ret.append(self.get_network_info(
|
||||
context, network=network, enable_dhcp=enable_dhcp,
|
||||
context, network=network, enable_dhcp=enable_dhcp, host=host,
|
||||
ports=grouped_ports.get(network.id, [])))
|
||||
|
||||
return ret
|
||||
|
@ -70,9 +70,9 @@ class TestDhcpRpcCallback(base.BaseTestCase):
|
||||
{'id': 'port2', 'network_id': 'net2'},
|
||||
{'id': 'port3', 'network_id': 'net3'}]
|
||||
self.plugin.get_ports.return_value = ports
|
||||
iter_kwargs = iter([{'enable_dhcp_filter': True},
|
||||
{'enable_dhcp_filter': False},
|
||||
{}])
|
||||
iter_kwargs = iter([{'enable_dhcp_filter': True, 'host': 'test-host'},
|
||||
{'enable_dhcp_filter': False, 'host': 'test-host'},
|
||||
{'host': 'test-host'}])
|
||||
with mock.patch.object(self.callbacks, '_get_active_networks') as \
|
||||
mock_get_networks, \
|
||||
mock.patch.object(self.callbacks, 'get_network_info') as \
|
||||
@ -86,11 +86,11 @@ class TestDhcpRpcCallback(base.BaseTestCase):
|
||||
None)
|
||||
mock_get_network_info.assert_has_calls([
|
||||
mock.call('ctx', network=networks[0], enable_dhcp=enable_dhcp,
|
||||
ports=[ports[0]]),
|
||||
host='test-host', ports=[ports[0]]),
|
||||
mock.call('ctx', network=networks[1], enable_dhcp=enable_dhcp,
|
||||
ports=[ports[1]]),
|
||||
host='test-host', ports=[ports[1]]),
|
||||
mock.call('ctx', network=networks[2], enable_dhcp=enable_dhcp,
|
||||
ports=[ports[2]])
|
||||
host='test-host', ports=[ports[2]])
|
||||
])
|
||||
|
||||
def _test__port_action_with_failures(self, exc=None, action=None):
|
||||
|
Loading…
Reference in New Issue
Block a user