Merge "[DHCP agent] Fetch OVN Metadata port from plugin" into stable/wallaby

This commit is contained in:
Zuul 2023-12-01 12:27:30 +00:00 committed by Gerrit Code Review
commit 56b8db138c
2 changed files with 4 additions and 1 deletions

View File

@ -1136,7 +1136,8 @@ class Dnsmasq(DhcpLocalProcess):
m_ports = [port for port in self.network.ports if
self._is_ovn_metadata_port(port, self.network.id)]
if m_ports:
for fixed_ip in m_ports[0].fixed_ips:
port = self.device_manager.plugin.get_dhcp_port(m_ports[0].id)
for fixed_ip in port.fixed_ips:
if fixed_ip.subnet_id == subnet.id:
return fixed_ip.ip_address

View File

@ -3124,6 +3124,8 @@ class TestDnsmasq(TestBase):
def test__generate_opts_per_subnet_with_metadata_port(self):
config = {'enable_isolated_metadata': False,
'force_metadata': False}
self.mock_mgr.return_value.plugin.get_dhcp_port.return_value = \
FakeOvnMetadataPort()
self._test__generate_opts_per_subnet_helper(config, True,
network_class=FakeNetworkDhcpandOvnMetadataPort)