Merge "Remove deprecated OVN LR external_id options"

This commit is contained in:
Zuul 2024-10-07 17:04:07 +00:00 committed by Gerrit Code Review
commit 1f83340a43
4 changed files with 0 additions and 64 deletions
neutron
common/ovn
plugins/ml2/drivers/ovn/mech_driver/ovsdb
tests/unit
fake_resources.py
plugins/ml2/drivers/ovn/mech_driver/ovsdb

@ -32,8 +32,6 @@ OVN_ROUTER_NAME_EXT_ID_KEY = 'neutron:router_name'
OVN_ROUTER_ID_EXT_ID_KEY = 'neutron:router_id'
OVN_AZ_HINTS_EXT_ID_KEY = 'neutron:availability_zone_hints'
OVN_ROUTER_IS_EXT_GW = 'neutron:is_ext_gw'
OVN_GW_PORT_EXT_ID_KEY = 'neutron:gw_port_id' # DEPRECATED, DON'T USE
OVN_GW_NETWORK_EXT_ID_KEY = 'neutron:gw_network_id' # DEPRECATED, DON'T USE
OVN_SUBNET_EXT_ID_KEY = 'neutron:subnet_id'
OVN_SUBNET_EXT_IDS_KEY = 'neutron:subnet_ids'
OVN_SUBNET_POOL_EXT_ADDR_SCOPE4_KEY = 'neutron:subnet_pool_addr_scope4'

@ -841,40 +841,6 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
txn.add(self._nb_idl.set_router_mac_age_limit())
raise periodics.NeverAgain()
# TODO(fnordahl): Remove this in the B+3 cycle. This method removes the
# now redundant "external_ids:OVN_GW_NETWORK_EXT_ID_KEY" and
# "external_ids:OVN_GW_PORT_EXT_ID_KEY" from to each router.
# 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 remove_gw_ext_ids_from_logical_router(self):
"""Remove `gw_port_id` and `gw_network_id` external_ids from LRs"""
cmds = []
for lr in self._nb_idl.lr_list().execute(check_error=True):
if (ovn_const.OVN_GW_PORT_EXT_ID_KEY not in lr.external_ids and
ovn_const.OVN_GW_NETWORK_EXT_ID_KEY not in
lr.external_ids):
# This router have none of the deprecated external_ids.
continue
external_ids = lr.external_ids.copy()
for k in (ovn_const.OVN_GW_PORT_EXT_ID_KEY,
ovn_const.OVN_GW_NETWORK_EXT_ID_KEY):
if k in external_ids:
del external_ids[k]
cmds.append(self._nb_idl.db_set(
'Logical_Router', lr.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().
@has_lock_periodic(

@ -906,7 +906,6 @@ class FakeOVNRouter(object):
return subnet_id
external_ids = {
ovn_const.OVN_GW_PORT_EXT_ID_KEY: router.get('gw_port_id') or '',
ovn_const.OVN_ROUTER_NAME_EXT_ID_KEY:
router.get('name', 'no_router_name')}

@ -918,33 +918,6 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
'NB_Global', '.',
options={'fdb_removal_limit': ovn_conf.get_fdb_removal_limit()})
def test_remove_gw_ext_ids_from_logical_router(self):
nb_idl = self.fake_ovn_client._nb_idl
# lr0: GW port ID, not GW network ID --> we need to remove port ID.
lr0 = fakes.FakeOvsdbRow.create_one_ovsdb_row(attrs={
'name': 'lr0',
'external_ids': {constants.OVN_GW_PORT_EXT_ID_KEY: 'port0'}})
# lr1: GW port ID and GW network ID --> we need to remove both.
lr1 = fakes.FakeOvsdbRow.create_one_ovsdb_row(attrs={
'name': 'lr1',
'external_ids': {constants.OVN_GW_PORT_EXT_ID_KEY: 'port1',
constants.OVN_GW_NETWORK_EXT_ID_KEY: 'net1'}})
# lr2: no GW port ID (nor GW network ID) --> no action needed.
lr2 = fakes.FakeOvsdbRow.create_one_ovsdb_row(attrs={
'name': 'lr2', 'external_ids': {}})
nb_idl.lr_list.return_value.execute.return_value = (lr0, lr1, lr2)
self.fake_ovn_client._plugin.get_port.return_value = {
'network_id': 'net0'}
self.assertRaises(
periodics.NeverAgain,
self.periodic.remove_gw_ext_ids_from_logical_router)
expected_calls = [mock.call('Logical_Router', lr0.uuid,
('external_ids', {})),
mock.call('Logical_Router', lr1.uuid,
('external_ids', {}))]
nb_idl.db_set.assert_has_calls(expected_calls)
def _test_check_baremetal_ports_dhcp_options(self, dhcp_disabled=False):
cfg.CONF.set_override('disable_ovn_dhcp_for_baremetal_ports',
dhcp_disabled, group='ovn')