Handle several dhcp agents for metadata over ipv6
[0] added the capability to the dhcp agent of handling metadata traffic
over ipv6. However, the added code doesn't handle the case when a
network is managed by more than one dhcp agent. This change fixes the
issue.
[0] https://review.opendev.org/c/openstack/neutron/+/715482
Change-Id: Ie1e0739f2c7390031af196e72c678ee626d0f8b8
Closes-Bug: #1989979
(cherry picked from commit 41a7479d0f
)
This commit is contained in:
parent
aab9421de0
commit
76c194c977
@ -794,7 +794,7 @@ class DhcpAgent(manager.Manager):
|
||||
'get_metadata_bind_interface', network, port=p)
|
||||
for p in network.ports
|
||||
if (p.device_owner == constants.DEVICE_OWNER_DHCP and
|
||||
p.admin_state_up)
|
||||
p.admin_state_up and self._is_port_on_this_agent(p))
|
||||
]
|
||||
if len(dhcp_ifaces) == 1:
|
||||
kwargs['bind_interface'] = dhcp_ifaces[0]
|
||||
|
@ -1043,18 +1043,38 @@ class TestDhcpAgentEventHandler(base.BaseTestCase):
|
||||
|
||||
def test_enable_isolated_metadata_proxy_with_metadata_network_ipv6(self):
|
||||
network = copy.deepcopy(fake_meta_network)
|
||||
network.ports = [fake_dhcp_port]
|
||||
dhcp_port_this_host = copy.deepcopy(fake_dhcp_port)
|
||||
dhcp_port_this_host.device_id = utils.get_dhcp_agent_device_id(
|
||||
network.id, self.dhcp.conf.host)
|
||||
network.ports = [dhcp_port_this_host]
|
||||
self._test_enable_isolated_metadata_proxy_ipv6(network)
|
||||
|
||||
def test_enable_isolated_metadata_proxy_with_metadata_network_dvr_ipv6(
|
||||
self):
|
||||
network = copy.deepcopy(fake_meta_dvr_network)
|
||||
network.ports = [fake_dhcp_port]
|
||||
dhcp_port_this_host = copy.deepcopy(fake_dhcp_port)
|
||||
dhcp_port_this_host.device_id = utils.get_dhcp_agent_device_id(
|
||||
network.id, self.dhcp.conf.host)
|
||||
network.ports = [dhcp_port_this_host]
|
||||
self._test_enable_isolated_metadata_proxy_ipv6(network)
|
||||
|
||||
def test_enable_isolated_metadata_proxy_with_dist_network_ipv6(self):
|
||||
network = copy.deepcopy(fake_dist_network)
|
||||
network.ports = [fake_dhcp_port]
|
||||
dhcp_port_this_host = copy.deepcopy(fake_dhcp_port)
|
||||
dhcp_port_this_host.device_id = utils.get_dhcp_agent_device_id(
|
||||
network.id, self.dhcp.conf.host)
|
||||
network.ports = [dhcp_port_this_host]
|
||||
self._test_enable_isolated_metadata_proxy_ipv6(network)
|
||||
|
||||
def test_enable_isolated_metadata_proxy_with_2_agents_network_ipv6(self):
|
||||
network = copy.deepcopy(fake_meta_network)
|
||||
dhcp_port_this_host = copy.deepcopy(fake_dhcp_port)
|
||||
dhcp_port_this_host.device_id = utils.get_dhcp_agent_device_id(
|
||||
network.id, self.dhcp.conf.host)
|
||||
dhcp_port_other_host = copy.deepcopy(fake_dhcp_port)
|
||||
dhcp_port_other_host.device_id = utils.get_dhcp_agent_device_id(
|
||||
network.id, 'otherhostname')
|
||||
network.ports = [dhcp_port_this_host, dhcp_port_other_host]
|
||||
self._test_enable_isolated_metadata_proxy_ipv6(network)
|
||||
|
||||
def _test_disable_isolated_metadata_proxy(self, network):
|
||||
|
Loading…
Reference in New Issue
Block a user