diff --git a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py index 7e427e272a2..b05e22ab128 100644 --- a/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py +++ b/neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/maintenance.py @@ -16,7 +16,6 @@ import abc import copy import inspect -import re import threading from futurist import periodics @@ -675,41 +674,6 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase): txn.add(cmd) raise periodics.NeverAgain() - # TODO(ralonsoh): Remove this in the Z+2 cycle - # A static spacing value is used here, but this method will only run - # once per lock due to the use of periodics.NeverAgain(). - @periodics.periodic(spacing=600, run_immediately=True) - def update_port_qos_with_external_ids_reference(self): - """Update all OVN QoS registers with the port ID - - This method will only update the OVN QoS registers related to port QoS, - not FIP QoS. FIP QoS have the corresponding "external_ids" reference. - """ - if not self.has_lock: - return - - regex = re.compile( - r'(inport|outport) == \"(?P[a-z0-9\-]{36})\"') - cmds = [] - for ls in self._nb_idl.ls_list().execute(check_error=True): - for qos in self._nb_idl.qos_list(ls.name).execute( - check_error=True): - if qos.external_ids: - continue - match = re.match(regex, qos.match) - if not match: - continue - port_id = match.group('port_id') - external_ids = {ovn_const.OVN_PORT_EXT_ID_KEY: port_id} - cmds.append(self._nb_idl.db_set( - 'QoS', qos.uuid, ('external_ids', external_ids))) - - if cmds: - with self._nb_idl.transaction(check_error=True) as txn: - for cmd in cmds: - txn.add(cmd) - raise periodics.NeverAgain() - # A static spacing value is used here, but this method will only run # once per lock due to the use of periodics.NeverAgain(). @periodics.periodic(spacing=600, run_immediately=True) diff --git a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_maintenance.py b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_maintenance.py index d03253fe066..4391102074f 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_maintenance.py +++ b/neutron/tests/unit/plugins/ml2/drivers/ovn/mech_driver/ovsdb/test_maintenance.py @@ -22,7 +22,6 @@ from neutron_lib import context from neutron_lib.db import api as db_api from oslo_config import cfg from oslo_serialization import jsonutils -from oslo_utils import uuidutils from neutron.common.ovn import constants from neutron.common.ovn import utils @@ -615,29 +614,6 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight, 'dynamic_neigh_routers': 'true'})] nb_idl.update_lrouter.assert_has_calls(expected_calls) - def test_update_port_qos_with_external_ids_reference(self): - nb_idl = self.fake_ovn_client._nb_idl - lrs = [fakes.FakeOvsdbRow.create_one_ovsdb_row( - attrs={'name': 'lr%s' % idx}) for idx in range(3)] - uuid1 = uuidutils.generate_uuid() - qoses1 = [fakes.FakeOvsdbRow.create_one_ovsdb_row( - attrs={'external_ids': {}, 'match': 'inport == "%s"' % uuid1})] - qoses2 = [fakes.FakeOvsdbRow.create_one_ovsdb_row( - attrs={'external_ids': {constants.OVN_PORT_EXT_ID_KEY: uuid1}, - 'match': 'inport == "%s"' % uuid1})] - qoses3 = [] - nb_idl.ls_list.return_value.execute.return_value = lrs - nb_idl.qos_list.return_value.execute.side_effect = [qoses1, qoses2, - qoses3] - self.assertRaises( - periodics.NeverAgain, - self.periodic.update_port_qos_with_external_ids_reference) - - external_ids = {constants.OVN_PORT_EXT_ID_KEY: uuid1} - expected_calls = [mock.call('QoS', qoses1[0].uuid, - ('external_ids', external_ids))] - nb_idl.db_set.assert_has_calls(expected_calls) - def _test_check_vlan_distributed_ports(self, opt_value=None): fake_net0 = {'id': 'net0'} fake_net1 = {'id': 'net1'}