Skip to content

Commit cd617d1

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "[DHCP agent] Fetch OVN Metadata port from plugin" into stable/yoga
2 parents cb95a5a + a4d2598 commit cd617d1

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
@@ -1144,7 +1144,8 @@ def _get_ovn_metadata_port_ip(self, subnet):
11441144
m_ports = [port for port in self.network.ports if
11451145
self._is_ovn_metadata_port(port, self.network.id)]
11461146
if m_ports:
1147-
for fixed_ip in m_ports[0].fixed_ips:
1147+
port = self.device_manager.plugin.get_dhcp_port(m_ports[0].id)
1148+
for fixed_ip in port.fixed_ips:
11481149
if fixed_ip.subnet_id == subnet.id:
11491150
return fixed_ip.ip_address
11501151

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,6 +3126,8 @@ def test__generate_opts_per_subnet_no_metadata(self):
31263126
def test__generate_opts_per_subnet_with_metadata_port(self):
31273127
config = {'enable_isolated_metadata': False,
31283128
'force_metadata': False}
3129+
self.mock_mgr.return_value.plugin.get_dhcp_port.return_value = \
3130+
FakeOvnMetadataPort()
31293131
self._test__generate_opts_per_subnet_helper(config, True,
31303132
network_class=FakeNetworkDhcpandOvnMetadataPort)
31313133

0 commit comments

Comments
 (0)