diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py index 082c72d2e6d..65b0179aaf5 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/ovn_client.py @@ -34,6 +34,7 @@ from neutron_lib.plugins import directory from neutron_lib.plugins import utils as p_utils from neutron_lib.services.logapi import constants as log_const 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 net as n_net from oslo_config import cfg @@ -294,6 +295,10 @@ class OVNClient(object): Defaults to True. """ 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 not db_port.port_bindings: return diff --git a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_client.py b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_client.py index c66e65420cf..6feec8b2877 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_client.py +++ b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_ovn_client.py @@ -31,6 +31,7 @@ from neutron.tests.unit.services.logapi.drivers.ovn \ from neutron_lib.api.definitions import l3 from neutron_lib import constants as 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 @@ -299,6 +300,15 @@ class TestOVNClient(TestOVNClientBase): 'Logical_Switch_Port', port_id, 'external_ids', 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') def test__wait_for_port_bindings_host(self, mock_get_port): context = mock.MagicMock()