Remove LB from LS belonging to provider networks

In core OVN, LBs on switches with localnet ports (i.e., neutron
provider networks) don't work if traffic comes from localnet [1]

In order to force NAT to happen at the virtual router instead
of the LS level, when the VIP of the LoadBalancer is associated
to a provider network we should avoid adding the LB to the
LS associated to the provider network

TODO:
- Open Launchpad bug
- Fix unittesting

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2164652

Change-Id: I009ddd2604d208bbf793e2d19d4195b77726f7b2
This commit is contained in:
Luis Tomas Bolivar 2023-01-26 17:04:55 +01:00
parent ef019ed63b
commit c7a1f5e892
1 changed files with 11 additions and 5 deletions

View File

@ -18,6 +18,7 @@ import re
import threading
import netaddr
from neutron_lib.api.definitions import external_net
from neutron_lib import constants as n_const
from neutronclient.common import exceptions as n_exc
from octavia_lib.api.drivers import data_models as o_datamodels
@ -989,11 +990,16 @@ class OvnProviderHelper():
loadbalancer[constants.ID],
protocol=protocol)
ovn_lb = ovn_lb if protocol else ovn_lb[0]
# NOTE(froyo): This is the association of the lb to the VIP ls
# so this is executed right away
self._update_lb_to_ls_association(
ovn_lb, network_id=port['network_id'],
associate=True, update_ls_ref=True)
# NOTE(ltomasbo): If the VIP is on a provider network, it does
# not need to be associated to its LS
network = neutron_client.show_network(port['network_id'])
if not network.get(external_net.PHYSICAL_NETWORK, False):
# NOTE(froyo): This is the association of the lb to the VIP ls
# so this is executed right away
self._update_lb_to_ls_association(
ovn_lb, network_id=port['network_id'],
associate=True, update_ls_ref=True)
ls_name = utils.ovn_name(port['network_id'])
ovn_ls = self.ovn_nbdb_api.ls_get(ls_name).execute(
check_error=True)