Merge "[OVN] Match LSP_TYPE_VIRTUAL in PortBindingUpdateVirtualPortsEvent"

This commit is contained in:
Zuul 2023-09-28 16:09:19 +00:00 committed by Gerrit Code Review
commit 22726b473e
2 changed files with 14 additions and 7 deletions

View File

@ -557,7 +557,7 @@ class PortBindingUpdateVirtualPortsEvent(row_event.RowEvent):
if event == self.ROW_DELETE:
# The port binding has been deleted, delete the host ID (if the
# port was not deleted before).
return True
return row.type == ovn_const.LSP_TYPE_VIRTUAL
virtual_parents = (row.options or {}).get(
ovn_const.LSP_OPTIONS_VIRTUAL_PARENTS_KEY)

View File

@ -360,12 +360,6 @@ class TestNBDbMonitor(base.TestOVNFunctionalBase):
# and the corresponding "virtual-parents".
self._check_port_binding_type(vip['id'], ovn_const.LSP_TYPE_VIRTUAL)
self._check_port_virtual_parents(vip['id'], port['id'])
n_utils.wait_until_true(lambda: mock_update_vip_host.called,
timeout=10)
# The "Port_Binding" has been deleted. Then the "Port_Binding" register
# is created again without virtual_parents, but this event doesn't
# call "update_virtual_port_host".
mock_update_vip_host.assert_called_once_with(vip['id'], None)
# 2) Unset the allowed address pairs.
# Assign the VIP again and delete the virtual port.
@ -406,6 +400,19 @@ class TestNBDbMonitor(base.TestOVNFunctionalBase):
# if this behaviour is changed.
mock_update_vip_host.assert_called_with(vip['id'], None)
@mock.patch.object(mech_driver.OVNMechanismDriver,
'update_virtual_port_host')
def test_non_virtual_port_no_host_update(self, mock_update_vip_host):
# The ``PortBindingUpdateVirtualPortsEvent`` delete event should affect
# only to virtual ports. This check is done for virtual ports in
# ``test_virtual_port_host_update``.
port = self.create_port()
self._delete('ports', port['id'])
# We actively wait for 5 seconds for the ``Port_Binding`` event to
# arrive and be processed, but the port host must not be updated.
self.assertRaises(n_utils.WaitTimeout, n_utils.wait_until_true,
lambda: mock_update_vip_host.called, timeout=5)
class TestNBDbMonitorOverTcp(TestNBDbMonitor):
def get_ovsdb_server_protocol(self):