From db030749278324b52b6d09f4d55a5d1e288d0abe Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Fri, 28 Mar 2025 03:33:07 +0000 Subject: [PATCH] Revert the network IDs filter in ``_gen_router_port_options`` In [1], a change in the ``network_ids`` filter was introduced. This filter is used to retrieve the networks belonging to a router. However this is used in two places: * To set the gateway MTU. Here all the networks attached to the router must be present. * To calculate the "redirect-type" value in the Logical_Router_Port. Only the internal interfaces must be present; the gateway port should be discarded. NOTE: patch [1] is present since 2025.1 (Epoxy). [1]https://review.opendev.org/c/openstack/neutron/+/937026 Closes-Bug: #2105383 Related-Bug: #2032817 Change-Id: I9cd6e77e47ce16dcf2fc46fc076f1d7ee7a4f9d3 --- .../ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py index dbd3bc24d3a..3b47467d522 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py @@ -1726,13 +1726,13 @@ class OVNClient: LOG.debug("Router %s not found", port['device_id']) else: network_ids = {port['network_id'] for port in router_ports} - # If this method is called during a port creation, the port - # won't be present yet in the router ports list. - network_ids.add(port['network_id']) - networks = None if ovn_conf.is_ovn_emit_need_to_frag_enabled(): + # If this method is called during a port creation, the port + # won't be present yet in the router ports list. It is + # needed not to modify the ``network_ids`` set. + _network_ids = network_ids.union({port['network_id']}) networks = self._plugin.get_networks( - admin_context, filters={'id': network_ids}) + admin_context, filters={'id': _network_ids}) # Set the lower MTU of all networks connected to the router min_mtu = str(min(net['mtu'] for net in networks)) options[ovn_const.OVN_ROUTER_PORT_GW_MTU_OPTION] = min_mtu @@ -1744,7 +1744,7 @@ class OVNClient: # If there are no VLAN type networks attached we need to # still make it centralized. enable_redirect = False - networks = networks or self._plugin.get_networks( + networks = self._plugin.get_networks( admin_context, filters={'id': network_ids}) if networks: enable_redirect = all(