[OVN] Remove maintenance method `check_for_mcast_flood_reports`

It was marked to be removed in B+3=E cycle.

Related-Bug: #1918108
Change-Id: I4f56c6bc04dee486335962ed9fc8f679881958e9
This commit is contained in:
Rodolfo Alonso Hernandez 2024-10-18 06:06:47 +00:00
parent 9347c427b5
commit a0cc380096
2 changed files with 0 additions and 185 deletions

View File

@ -551,68 +551,6 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
raise periodics.NeverAgain()
# TODO(lucasagomes): Remove this in the B+3 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_for_mcast_flood_reports(self):
mcast_flood_conf = ovs_conf.get_igmp_flood()
mcast_flood_reports_conf = ovs_conf.get_igmp_flood_reports()
cmds = []
for port in self._nb_idl.lsp_list().execute(check_error=True):
port_type = port.type.strip()
options = port.options
mcast_flood_reports_value = options.get(
ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS)
mcast_flood_value = options.get(
ovn_const.LSP_OPTIONS_MCAST_FLOOD)
if self._ovn_client.is_mcast_flood_broken:
if port_type in ("vtep", ovn_const.LSP_TYPE_LOCALPORT,
"router"):
continue
if port_type == ovn_const.LSP_TYPE_LOCALNET:
mcast_flood_value = options.pop(
ovn_const.LSP_OPTIONS_MCAST_FLOOD, None)
if mcast_flood_value:
cmds.append(self._nb_idl.db_remove(
'Logical_Switch_Port', port.name, 'options',
ovn_const.LSP_OPTIONS_MCAST_FLOOD,
if_exists=True))
if mcast_flood_reports_value == 'true':
continue
options.update(
{ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true'})
cmds.append(self._nb_idl.lsp_set_options(port.name, **options))
elif (mcast_flood_reports_value and port_type !=
ovn_const.LSP_TYPE_LOCALNET):
cmds.append(self._nb_idl.db_remove(
'Logical_Switch_Port', port.name, 'options',
ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS, if_exists=True))
elif (port_type == ovn_const.LSP_TYPE_LOCALNET and (
mcast_flood_conf != mcast_flood_value or
mcast_flood_reports_conf != mcast_flood_reports_value)):
options.update({
ovn_const.LSP_OPTIONS_MCAST_FLOOD: mcast_flood_conf,
ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS:
mcast_flood_reports_conf})
cmds.append(self._nb_idl.lsp_set_options(port.name, **options))
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().
@has_lock_periodic(

View File

@ -455,129 +455,6 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
nb_idl.set_lswitch_port.assert_has_calls(expected_calls,
any_order=True)
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
lsp0 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp0',
'options': {
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true'},
'type': ""})
lsp1 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp1', 'options': {}, 'type': ""})
lsp2 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp2', 'options': {},
'type': "vtep"})
lsp3 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp3', 'options': {},
'type': constants.LSP_TYPE_LOCALPORT})
lsp4 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp4', 'options': {},
'type': "router"})
lsp5 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp5', 'options': {}, 'type': 'localnet'})
lsp6 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp6',
'options': {
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true',
constants.LSP_OPTIONS_MCAST_FLOOD: 'true'},
'type': 'localnet'})
lsp7 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp7',
'options': {
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true',
constants.LSP_OPTIONS_MCAST_FLOOD: 'false'},
'type': 'localnet'})
nb_idl.lsp_list.return_value.execute.return_value = [
lsp0, lsp1, lsp2, lsp3, lsp4, lsp5, lsp6, lsp7]
# Invoke the periodic method, it meant to run only once at startup
# so NeverAgain will be raised at the end
self.assertRaises(periodics.NeverAgain,
self.periodic.check_for_mcast_flood_reports)
# Assert only lsp1 and lsp5 were called because they are the
# only ones meeting to set mcast_flood_reports to 'true'
expected_calls = [
mock.call('lsp1', mcast_flood_reports='true'),
mock.call('lsp5', mcast_flood_reports='true')]
nb_idl.lsp_set_options.assert_has_calls(expected_calls)
self.assertEqual(2, nb_idl.lsp_set_options.call_count)
# Assert only lsp6 and lsp7 were called because they are the
# only ones meeting to remove mcast_flood
expected_calls = [
mock.call('Logical_Switch_Port', 'lsp6', 'options',
constants.LSP_OPTIONS_MCAST_FLOOD,
if_exists=True),
mock.call('Logical_Switch_Port', 'lsp7', 'options',
constants.LSP_OPTIONS_MCAST_FLOOD,
if_exists=True)]
nb_idl.db_remove.assert_has_calls(expected_calls)
self.assertEqual(2, nb_idl.db_remove.call_count)
def test_check_for_mcast_flood_reports(self):
self.fake_ovn_client.is_mcast_flood_broken = False
nb_idl = self.fake_ovn_client._nb_idl
lsp0 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp0',
'options': {
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true'},
'type': ""})
lsp1 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp1', 'options': {}, 'type': ""})
lsp2 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp2',
'options': {
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true'},
'type': "vtep"})
lsp3 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp3', 'options': {},
'type': constants.LSP_TYPE_LOCALPORT})
lsp4 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp4', 'options': {},
'type': "router"})
lsp5 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp5', 'options': {},
'type': constants.LSP_TYPE_LOCALNET})
lsp6 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp6',
'options': {
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true',
constants.LSP_OPTIONS_MCAST_FLOOD: 'true'},
'type': constants.LSP_TYPE_LOCALNET})
lsp7 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
attrs={'name': 'lsp7',
'options': {
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true',
constants.LSP_OPTIONS_MCAST_FLOOD: 'false'},
'type': constants.LSP_TYPE_LOCALNET})
nb_idl.lsp_list.return_value.execute.return_value = [
lsp0, lsp1, lsp2, lsp3, lsp4, lsp5, lsp6, lsp7]
# Invoke the periodic method, it meant to run only once at startup
# so NeverAgain will be raised at the end
self.assertRaises(periodics.NeverAgain,
self.periodic.check_for_mcast_flood_reports)
# Assert only lsp0 and lsp2 were called because they are the
# only ones meeting the criteria
expected_calls = [
mock.call('Logical_Switch_Port', 'lsp0', 'options',
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS,
if_exists=True),
mock.call('Logical_Switch_Port', 'lsp2', 'options',
constants.LSP_OPTIONS_MCAST_FLOOD_REPORTS,
if_exists=True)]
nb_idl.db_remove.assert_has_calls(expected_calls)
self.assertEqual(2, nb_idl.db_remove.call_count)
def test_check_localnet_port_has_learn_fdb(self):
cfg.CONF.set_override('localnet_learn_fdb', 'True',
group='ovn')