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

This commit is contained in:
Zuul 2023-12-14 16:17:54 +00:00 committed by Gerrit Code Review
commit 69ea9a96dc
2 changed files with 4 additions and 6 deletions

View File

@ -665,8 +665,7 @@ 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):