[OVN] Remove maintenance method `check_port_has_address_scope
`
It was marked to be removed in A+4=E cycle. Related-Bug: #1996741 Change-Id: Ibb1fd1ada36eb496293c4362456e5a6bcf3a21a8
This commit is contained in:
parent
6d05519e93
commit
9347c427b5
@ -521,45 +521,6 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
||||
|
||||
raise periodics.NeverAgain()
|
||||
|
||||
# TODO(czesla): Remove this in the A+4 cycle
|
||||
# A static spacing value is used here, but this method will only run
|
||||
# once per lock due to the use of periodics.NeverAgain().
|
||||
@has_lock_periodic(
|
||||
periodic_run_limit=ovn_const.MAINTENANCE_TASK_RETRY_LIMIT,
|
||||
spacing=ovn_const.MAINTENANCE_ONE_RUN_TASK_SPACING,
|
||||
run_immediately=True)
|
||||
def check_port_has_address_scope(self):
|
||||
ports = self._nb_idl.db_find_rows(
|
||||
"Logical_Switch_Port", ("type", "!=", ovn_const.LSP_TYPE_LOCALNET)
|
||||
).execute(check_error=True)
|
||||
|
||||
context = n_context.get_admin_context()
|
||||
with self._nb_idl.transaction(check_error=True) as txn:
|
||||
for port in ports:
|
||||
if (port.external_ids.get(
|
||||
ovn_const.OVN_SUBNET_POOL_EXT_ADDR_SCOPE4_KEY)
|
||||
is None or
|
||||
port.external_ids.get(
|
||||
ovn_const.OVN_SUBNET_POOL_EXT_ADDR_SCOPE6_KEY)
|
||||
is None):
|
||||
try:
|
||||
port_neutron = self._ovn_client._plugin.get_port(
|
||||
context, port.name
|
||||
)
|
||||
|
||||
port_info, external_ids = (
|
||||
self._ovn_client.get_external_ids_from_port(
|
||||
port_neutron)
|
||||
)
|
||||
txn.add(self._nb_idl.set_lswitch_port(
|
||||
port.name, external_ids=external_ids))
|
||||
except n_exc.PortNotFound:
|
||||
# The sync function will fix this port
|
||||
pass
|
||||
except Exception:
|
||||
LOG.exception('Failed to update port %s', port.name)
|
||||
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().
|
||||
@has_lock_periodic(
|
||||
|
@ -36,7 +36,6 @@ from neutron.tests import base
|
||||
from neutron.tests.unit import fake_resources as fakes
|
||||
from neutron.tests.unit.plugins.ml2 import test_security_group as test_sg
|
||||
from neutron.tests.unit import testlib_api
|
||||
from neutron_lib import exceptions as n_exc
|
||||
|
||||
|
||||
class TestHasLockPeriodicDecorator(base.BaseTestCase):
|
||||
@ -456,82 +455,6 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
|
||||
nb_idl.set_lswitch_port.assert_has_calls(expected_calls,
|
||||
any_order=True)
|
||||
|
||||
def test_check_port_has_address_scope(self):
|
||||
self.fake_ovn_client.is_external_ports_supported.return_value = True
|
||||
nb_idl = self.fake_ovn_client._nb_idl
|
||||
|
||||
# Already has the address scope set but empty, nothing to do
|
||||
lsp0 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
attrs={
|
||||
"uuid": "1f4323db-fb58-48e9-adae-6c6e833c581f",
|
||||
"name": "lsp0",
|
||||
"external_ids": {
|
||||
constants.OVN_SUBNET_POOL_EXT_ADDR_SCOPE4_KEY: "",
|
||||
constants.OVN_SUBNET_POOL_EXT_ADDR_SCOPE6_KEY: "",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
# address scope is missing, needs update
|
||||
lsp1 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
attrs={
|
||||
"uuid": "1f4323db-fb58-48e9-adae-6c6e833c581d",
|
||||
"name": "lsp1",
|
||||
"external_ids": {},
|
||||
}
|
||||
)
|
||||
|
||||
# Already has the address scope set, nothing to do
|
||||
lsp2 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
attrs={
|
||||
"uuid": "1f4323db-fb58-48e9-adae-6c6e833c581a",
|
||||
"name": "lsp2",
|
||||
"external_ids": {
|
||||
constants.OVN_SUBNET_POOL_EXT_ADDR_SCOPE4_KEY: "fakev4",
|
||||
constants.OVN_SUBNET_POOL_EXT_ADDR_SCOPE6_KEY: "fakev6",
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
# address scope is missing, needs update but port is missing in ovn
|
||||
lsp4 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
attrs={
|
||||
"uuid": "1f4323db-fb58-48e9-adae-6c6e833c581c",
|
||||
"name": "lsp4",
|
||||
"external_ids": {},
|
||||
}
|
||||
)
|
||||
|
||||
nb_idl.db_find_rows.return_value.execute.return_value = [
|
||||
lsp0,
|
||||
lsp1,
|
||||
lsp2,
|
||||
lsp4,
|
||||
]
|
||||
|
||||
self.fake_ovn_client._plugin.get_port.side_effect = [
|
||||
{"network_id": "net0"},
|
||||
n_exc.PortNotFound(port_id="port"),
|
||||
]
|
||||
|
||||
external_ids = {
|
||||
constants.OVN_SUBNET_POOL_EXT_ADDR_SCOPE4_KEY: "address_scope_v4",
|
||||
constants.OVN_SUBNET_POOL_EXT_ADDR_SCOPE6_KEY: "address_scope_v6",
|
||||
}
|
||||
|
||||
self.fake_ovn_client.get_external_ids_from_port.return_value = (
|
||||
None,
|
||||
external_ids,
|
||||
)
|
||||
|
||||
self.assertRaises(
|
||||
periodics.NeverAgain, self.periodic.check_port_has_address_scope
|
||||
)
|
||||
|
||||
nb_idl.set_lswitch_port.assert_called_once_with(
|
||||
"lsp1", external_ids=external_ids
|
||||
)
|
||||
|
||||
def test_check_for_mcast_flood_reports_broken(self):
|
||||
self.fake_ovn_client.is_mcast_flood_broken = True
|
||||
nb_idl = self.fake_ovn_client._nb_idl
|
||||
|
Loading…
x
Reference in New Issue
Block a user