[OVN] Remove "update_port_qos_with_external_ids_reference"
This method was planned to be removed in Bobcat. Trivial-Fix Change-Id: I87b568d5f9a699b09c00cbf5e1b0eae71ccab876
This commit is contained in:
parent
9d5d706f7b
commit
745497a112
|
@ -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<port_id>[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)
|
||||
|
|
|
@ -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'}
|
||||
|
|
Loading…
Reference in New Issue