Fix watcher logic for exposing OVN LB with the NB DB driver

Change-Id: I0641e79139d2452f1d6053f878769ff18a4a8a7d
This commit is contained in:
Luis Tomas Bolivar 2023-12-14 13:01:28 +01:00
parent 546a8bef21
commit e388367076
2 changed files with 4 additions and 6 deletions

View File

@ -665,9 +665,8 @@ class OVNLBCreateEvent(base_watcher.OVNLBEvent):
vip_fip = self._get_vip_fip(row) vip_fip = self._get_vip_fip(row)
old_vip_fip = self._get_vip_fip(old) old_vip_fip = self._get_vip_fip(old)
with _SYNC_STATE_LOCK.read_lock(): with _SYNC_STATE_LOCK.read_lock():
if hasattr(old, 'external_ids'): if hasattr(old, 'external_ids') and vip_fip != old_vip_fip:
if vip_fip and vip_fip != old_vip_fip: self.agent.expose_ovn_lb_fip(row)
self.agent.expose_ovn_lb_fip(row)
else: else:
self.agent.expose_ovn_lb_vip(row) self.agent.expose_ovn_lb_vip(row)

View File

@ -1198,7 +1198,7 @@ class TestOVNLBCreateEvent(test_base.TestCase):
self.agent.expose_ovn_lb_vip.assert_called_once_with(row) self.agent.expose_ovn_lb_vip.assert_called_once_with(row)
self.agent.expose_ovn_lb_fip.assert_not_called() self.agent.expose_ovn_lb_fip.assert_not_called()
def test_run_vip_added_extra_ext_id_info(self): def test_run_vip_added_router(self):
row = utils.create_row( row = utils.create_row(
external_ids={ external_ids={
constants.OVN_LB_LR_REF_EXT_ID_KEY: 'neutron-router1', constants.OVN_LB_LR_REF_EXT_ID_KEY: 'neutron-router1',
@ -1208,13 +1208,12 @@ class TestOVNLBCreateEvent(test_base.TestCase):
vips={'vip': 'member', 'fip': 'member'}) vips={'vip': 'member', 'fip': 'member'})
old = utils.create_row( old = utils.create_row(
external_ids={ external_ids={
constants.OVN_LB_LR_REF_EXT_ID_KEY: 'neutron-router1',
constants.OVN_LB_VIP_FIP_EXT_ID_KEY: 'fip', constants.OVN_LB_VIP_FIP_EXT_ID_KEY: 'fip',
constants.OVN_LS_NAME_EXT_ID_KEY: 'net1'}) constants.OVN_LS_NAME_EXT_ID_KEY: 'net1'})
self.event.run(None, row, old) self.event.run(None, row, old)
self.agent.expose_ovn_lb_vip.assert_not_called() self.agent.expose_ovn_lb_vip.assert_called_once_with(row)
self.agent.expose_ovn_lb_fip.assert_not_called() self.agent.expose_ovn_lb_fip.assert_not_called()
def test_run_fip(self): def test_run_fip(self):