Merge "[OVN] Check LSP.up status before setting the port host info" into stable/2024.1
This commit is contained in:
commit
df8cf201f1
@ -297,7 +297,14 @@ class OVNClient(object):
|
|||||||
# NOTE(ralonsoh): OVN subports don't have host ID information.
|
# NOTE(ralonsoh): OVN subports don't have host ID information.
|
||||||
return
|
return
|
||||||
|
|
||||||
|
port_up = self._nb_idl.lsp_get_up(db_port.id).execute(
|
||||||
|
check_error=True)
|
||||||
if up:
|
if up:
|
||||||
|
if not port_up:
|
||||||
|
LOG.warning('Logical_Switch_Port %s host information not '
|
||||||
|
'updated, the port state is down')
|
||||||
|
return
|
||||||
|
|
||||||
if not db_port.port_bindings:
|
if not db_port.port_bindings:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -319,6 +326,11 @@ class OVNClient(object):
|
|||||||
self._nb_idl.db_set(
|
self._nb_idl.db_set(
|
||||||
'Logical_Switch_Port', db_port.id, ext_ids))
|
'Logical_Switch_Port', db_port.id, ext_ids))
|
||||||
else:
|
else:
|
||||||
|
if port_up:
|
||||||
|
LOG.warning('Logical_Switch_Port %s host information not '
|
||||||
|
'removed, the port state is up')
|
||||||
|
return
|
||||||
|
|
||||||
cmd.append(
|
cmd.append(
|
||||||
self._nb_idl.db_remove(
|
self._nb_idl.db_remove(
|
||||||
'Logical_Switch_Port', db_port.id, 'external_ids',
|
'Logical_Switch_Port', db_port.id, 'external_ids',
|
||||||
|
@ -245,6 +245,7 @@ class TestOVNClient(TestOVNClientBase):
|
|||||||
context = mock.MagicMock()
|
context = mock.MagicMock()
|
||||||
port_id = 'fake-port-id'
|
port_id = 'fake-port-id'
|
||||||
db_port = mock.Mock(id=port_id)
|
db_port = mock.Mock(id=port_id)
|
||||||
|
self.nb_idl.lsp_get_up.return_value.execute.return_value = False
|
||||||
|
|
||||||
self.ovn_client.update_lsp_host_info(context, db_port, up=False)
|
self.ovn_client.update_lsp_host_info(context, db_port, up=False)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user