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
This commit is contained in:
Rodolfo Alonso Hernandez
2025-03-28 03:33:07 +00:00
parent 196b2c9874
commit db03074927

View File

@@ -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(