[DHCP agent] Fetch OVN Metadata port from plugin
OVN metadata port from NetworkCache is being used and fixed_ips
for it were not available at the time network was added into
the cache. So let's re fetch it if it is available in the cache.
Related-Bug: #1982569
Related-Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2213862
Change-Id: Ie0ec43566fa2b3e13b4917493336ce1519c9b6bb
(cherry picked from commit 0afa24d9af)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -3125,6 +3125,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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user