From 7c8be3ccbc4c51126a3efccfd5b7c3dd57e7ac40 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Wed, 4 Dec 2024 13:40:43 +0000 Subject: [PATCH] [OVN] Optimization in the router port options generation The networks are retrieved only if needed, that is if the configuration flags ``ovn_emit_need_to_frag`` or ``enable_distributed_floating_ip`` are set. Trivial-Fix Change-Id: I6cd904310827bdb8692de632f91bfc90774e55a5 --- .../ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 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 64f71ea963a..4d5712394ed 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 @@ -1715,9 +1715,10 @@ class OVNClient: LOG.debug("Router %s not found", port['device_id']) else: network_ids = {port['network_id'] for port in router_ports} - networks = self._plugin.get_networks( - admin_context, filters={'id': network_ids}) + networks = None if ovn_conf.is_ovn_emit_need_to_frag_enabled(): + networks = self._plugin.get_networks( + admin_context, filters={'id': network_ids}) for net in networks: if net['mtu'] > network_mtu: options[ @@ -1732,6 +1733,8 @@ 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( + admin_context, filters={'id': network_ids}) if networks: enable_redirect = all( net.get(pnet.NETWORK_TYPE) in [const.TYPE_VLAN,