Merge "Skip LSP host info update for trunk subports"

This commit is contained in:
Zuul 2024-10-24 16:09:06 +00:00 committed by Gerrit Code Review
commit 8c6bcd9888
2 changed files with 15 additions and 0 deletions

View File

@ -34,6 +34,7 @@ from neutron_lib.plugins import directory
from neutron_lib.plugins import utils as p_utils from neutron_lib.plugins import utils as p_utils
from neutron_lib.services.logapi import constants as log_const from neutron_lib.services.logapi import constants as log_const
from neutron_lib.services.qos import constants as qos_consts from neutron_lib.services.qos import constants as qos_consts
from neutron_lib.services.trunk import constants as trunk_const
from neutron_lib.utils import helpers from neutron_lib.utils import helpers
from neutron_lib.utils import net as n_net from neutron_lib.utils import net as n_net
from oslo_config import cfg from oslo_config import cfg
@ -294,6 +295,10 @@ class OVNClient(object):
Defaults to True. Defaults to True.
""" """
cmd = [] cmd = []
if db_port.device_owner == trunk_const.TRUNK_SUBPORT_OWNER:
# NOTE(ralonsoh): OVN subports don't have host ID information.
return
if up: if up:
if not db_port.port_bindings: if not db_port.port_bindings:
return return

View File

@ -31,6 +31,7 @@ from neutron.tests.unit.services.logapi.drivers.ovn \
from neutron_lib.api.definitions import l3 from neutron_lib.api.definitions import l3
from neutron_lib import constants as const from neutron_lib import constants as const
from neutron_lib.services.logapi import constants as log_const from neutron_lib.services.logapi import constants as log_const
from neutron_lib.services.trunk import constants as trunk_const
from tenacity import wait_none from tenacity import wait_none
@ -299,6 +300,15 @@ class TestOVNClient(TestOVNClientBase):
'Logical_Switch_Port', port_id, 'external_ids', 'Logical_Switch_Port', port_id, 'external_ids',
constants.OVN_HOST_ID_EXT_ID_KEY, if_exists=True) constants.OVN_HOST_ID_EXT_ID_KEY, if_exists=True)
def test_update_lsp_host_info_trunk_subport(self):
context = mock.MagicMock()
db_port = mock.Mock(id='fake-port-id',
device_owner=trunk_const.TRUNK_SUBPORT_OWNER)
self.ovn_client.update_lsp_host_info(context, db_port)
self.nb_idl.db_remove.assert_not_called()
self.nb_idl.db_set.assert_not_called()
@mock.patch.object(ml2_db, 'get_port') @mock.patch.object(ml2_db, 'get_port')
def test__wait_for_port_bindings_host(self, mock_get_port): def test__wait_for_port_bindings_host(self, mock_get_port):
context = mock.MagicMock() context = mock.MagicMock()