Skip to content

Commit ae90f38

Browse files
committed
[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 0afa24d)
1 parent 87f7b9a commit ae90f38

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

neutron/agent/linux/dhcp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,8 @@ def _get_ovn_metadata_port_ip(self, subnet):
12131213
m_ports = [port for port in self.network.ports if
12141214
self._is_ovn_metadata_port(port, self.network.id)]
12151215
if m_ports:
1216-
for fixed_ip in m_ports[0].fixed_ips:
1216+
port = self.device_manager.plugin.get_dhcp_port(m_ports[0].id)
1217+
for fixed_ip in port.fixed_ips:
12171218
if fixed_ip.subnet_id == subnet.id:
12181219
return fixed_ip.ip_address
12191220

neutron/tests/unit/agent/linux/test_dhcp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,6 +3205,8 @@ def test__generate_opts_per_subnet_no_metadata(self):
32053205
def test__generate_opts_per_subnet_with_metadata_port(self):
32063206
config = {'enable_isolated_metadata': False,
32073207
'force_metadata': False}
3208+
self.mock_mgr.return_value.plugin.get_dhcp_port.return_value = \
3209+
FakeOvnMetadataPort()
32083210
self._test__generate_opts_per_subnet_helper(config, True,
32093211
network_class=FakeNetworkDhcpandOvnMetadataPort)
32103212

0 commit comments

Comments
 (0)