Merge "ovn: Don't use dict.remove() for filtering dhcp ports in db-sync"

This commit is contained in:
Zuul 2021-06-10 16:28:53 +00:00 committed by Gerrit Code Review
commit a80ca6629e
1 changed files with 10 additions and 10 deletions

View File

@ -890,16 +890,16 @@ class OvnNbSynchronizer(OvnDbSynchronizer):
# TODO(mjozefcz): Remove constants.DEVICE_OWNER_DHCP
# from get_ports in W-release.
for net in self.core_plugin.get_networks(ctx):
dhcp_ports = self.core_plugin.get_ports(ctx, filters=dict(
network_id=[net['id']],
device_owner=[
constants.DEVICE_OWNER_DISTRIBUTED,
constants.DEVICE_OWNER_DHCP]))
for port in dhcp_ports:
# Do not touch the Neutron DHCP agents ports
if utils.is_neutron_dhcp_agent_port(port):
dhcp_ports.remove(port)
# Get only DHCP ports that don't belong to agent, it should return
# only OVN metadata ports
dhcp_ports = [
p for p in self.core_plugin.get_ports(
ctx, filters=dict(
network_id=[net['id']],
device_owner=[
constants.DEVICE_OWNER_DISTRIBUTED,
constants.DEVICE_OWNER_DHCP]))
if not utils.is_neutron_dhcp_agent_port(p)]
if not dhcp_ports:
LOG.warning('Missing metadata port found in Neutron for '