Ensure LB are removed from LS not connected to the LB LR

Once the logical_switch (neutron subnet) is removed from the
logical_router (neutron router) where the OVN-LB VIP and members
are connected to, there is no need to keep the LB added to that
logical_switch

Closes-Bug: #1992356
Change-Id: I86aba3eee88b3da3cae7b57da2eabc6c3cb5d953
(cherry picked from commit 464cb97fad)
This commit is contained in:
Luis Tomas Bolivar 2022-10-10 17:13:27 +02:00
parent 4fd717c92c
commit 361f2ca155
2 changed files with 6 additions and 2 deletions

View File

@ -586,7 +586,10 @@ class OvnProviderHelper(object):
ovn_ls.uuid, ovn_lb.uuid, may_exist=True))
else:
if ls_name not in ls_refs:
# Nothing to be done.
if ovn_ls:
commands.append(self.ovn_nbdb_api.ls_lb_del(
ovn_ls.uuid, ovn_lb.uuid, if_exists=True))
# Nothing else to be done.
return commands
ref_ct = ls_refs[ls_name]

View File

@ -2581,7 +2581,8 @@ class TestOvnProviderHelper(ovn_base.TestOvnOctaviaBase):
self.helper.ovn_nbdb_api.ls_get.assert_called_once_with(
'neutron-foo')
self.helper.ovn_nbdb_api.db_set.assert_not_called()
self.helper.ovn_nbdb_api.ls_lb_del.assert_not_called()
self.helper.ovn_nbdb_api.ls_lb_del.assert_called_once_with(
self.network.uuid, self.ref_lb1.uuid, if_exists=True)
def test__update_lb_to_ls_association_net_ls_ref_wrong_format(self):
self._update_lb_to_ls_association.stop()