Ensure FIPs events are properly handled

When adding the exception for external networks that are not
provider [1] we break the logic for handling the FIPs association
events, and only the sync action was correcting it -- also hidding
the problem

With this patch we make the proper checking (on the patch port,
not on the VM port) to decide to only expose the FIPs if the
external networks is also a provider one

[1] d9c7de6465

Change-Id: Ie344ff0f477e32df270dedea02ff5b689f45836a
This commit is contained in:
Luis Tomas Bolivar 2023-04-20 15:36:30 +02:00
parent 62fe558114
commit 2553998649
2 changed files with 4 additions and 4 deletions

View File

@ -580,7 +580,7 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
elif row.type == constants.OVN_PATCH_VIF_PORT_TYPE:
if (associated_port and self.sb_idl.is_port_on_chassis(
associated_port, self.chassis)):
if not self.ovn_local_cr_lrps.get(associated_port):
if not self.sb_idl.is_provider_network(row.datapath):
# Only exposing IPs if the associated network is a
# provider network
return []
@ -722,7 +722,7 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
self.sb_idl.is_port_on_chassis(
associated_port, self.chassis) or
self.sb_idl.is_port_deleted(associated_port))):
if not self.ovn_local_cr_lrps.get(associated_port):
if not self.sb_idl.is_provider_network(row.datapath):
# Only exposing IPs if the associated network is a
# provider network
return

View File

@ -1245,7 +1245,7 @@ class TestOVNBGPDriver(test_base.TestCase):
@mock.patch.object(linux_net, 'add_ips_to_dev')
def test__expose_ip_fip_association_to_vm(
self, mock_add_ip_dev, mock_add_rule, mock_add_route):
self.sb_idl.is_provider_network.return_value = False
self.sb_idl.is_provider_network.return_value = True
self.sb_idl.is_port_on_chassis.return_value = True
mock_get_bridge = mock.patch.object(
self.bgp_driver, '_get_bridge_for_datapath').start()
@ -1500,7 +1500,7 @@ class TestOVNBGPDriver(test_base.TestCase):
@mock.patch.object(linux_net, 'del_ips_from_dev')
def test_withdraw_ip_fip_association_to_vm(
self, mock_del_ip_dev, mock_del_rule, mock_del_route):
self.sb_idl.is_provider_network.return_value = False
self.sb_idl.is_provider_network.return_value = True
self.sb_idl.is_port_on_chassis.return_value = True
mock_get_bridge = mock.patch.object(
self.bgp_driver, '_get_bridge_for_datapath').start()