Merge "[OVN] Tune OVN routers to reduce the mem footprint for ML2/OVN" into stable/xena
This commit is contained in:
commit
645d5df548
|
@ -14,6 +14,7 @@
|
|||
# under the License.
|
||||
|
||||
import abc
|
||||
import copy
|
||||
import inspect
|
||||
import threading
|
||||
|
||||
|
@ -684,6 +685,31 @@ class DBInconsistenciesPeriodics(SchemaAwarePeriodicsBase):
|
|||
|
||||
raise periodics.NeverAgain()
|
||||
|
||||
# TODO(lucasagomes): Remove this in the Z 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 check_router_mac_binding_options(self):
|
||||
if not self.has_lock:
|
||||
return
|
||||
|
||||
cmds = []
|
||||
for router in self._nb_idl.lr_list().execute(check_error=True):
|
||||
if (router.options.get('always_learn_from_arp_request') and
|
||||
router.options.get('dynamic_neigh_routers')):
|
||||
continue
|
||||
|
||||
opts = copy.deepcopy(router.options)
|
||||
opts.update({'always_learn_from_arp_request': 'false',
|
||||
'dynamic_neigh_routers': 'true'})
|
||||
cmds.append(self._nb_idl.update_lrouter(router.name, options=opts))
|
||||
|
||||
if cmds:
|
||||
with self._nb_idl.transaction(check_error=True) as txn:
|
||||
for cmd in cmds:
|
||||
txn.add(cmd)
|
||||
raise periodics.NeverAgain()
|
||||
|
||||
|
||||
class HashRingHealthCheckPeriodics(object):
|
||||
|
||||
|
|
|
@ -1223,11 +1223,13 @@ class OVNClient(object):
|
|||
enabled = router.get('admin_state_up')
|
||||
lrouter_name = utils.ovn_name(router['id'])
|
||||
added_gw_port = None
|
||||
options = {'always_learn_from_arp_request': 'false',
|
||||
'dynamic_neigh_routers': 'true'}
|
||||
with self._nb_idl.transaction(check_error=True) as txn:
|
||||
txn.add(self._nb_idl.create_lrouter(lrouter_name,
|
||||
external_ids=external_ids,
|
||||
enabled=enabled,
|
||||
options={}))
|
||||
options=options))
|
||||
# TODO(lucasagomes): add_external_gateway is being only used
|
||||
# by the ovn_db_sync.py script, remove it after the database
|
||||
# synchronization work
|
||||
|
|
|
@ -448,3 +448,31 @@ class TestDBInconsistenciesPeriodics(testlib_api.SqlTestCaseLight,
|
|||
mock.call('lsp5', mcast_flood_reports='true', mcast_flood='false')]
|
||||
|
||||
nb_idl.lsp_set_options.assert_has_calls(expected_calls)
|
||||
|
||||
def test_check_router_mac_binding_options(self):
|
||||
nb_idl = self.fake_ovn_client._nb_idl
|
||||
lr0 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
attrs={'name': 'lr0',
|
||||
'options': {'always_learn_from_arp_request': 'false',
|
||||
'dynamic_neigh_routers': 'true'}})
|
||||
lr1 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
attrs={'name': 'lr1', 'options': {}})
|
||||
lr2 = fakes.FakeOvsdbRow.create_one_ovsdb_row(
|
||||
attrs={'name': 'lr2', 'options': {}})
|
||||
nb_idl.lr_list.return_value.execute.return_value = [lr0, lr1, lr2]
|
||||
|
||||
# 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_router_mac_binding_options)
|
||||
|
||||
# Assert lr1 and lr2 had their options updated since the values
|
||||
# were not set
|
||||
expected_calls = [
|
||||
mock.call('lr1',
|
||||
options={'always_learn_from_arp_request': 'false',
|
||||
'dynamic_neigh_routers': 'true'}),
|
||||
mock.call('lr2',
|
||||
options={'always_learn_from_arp_request': 'false',
|
||||
'dynamic_neigh_routers': 'true'})]
|
||||
nb_idl.update_lrouter.assert_has_calls(expected_calls)
|
||||
|
|
|
@ -543,7 +543,8 @@ class TestOVNL3RouterPlugin(test_mech_driver.Ml2PluginV2TestCase):
|
|||
ovn_const.OVN_AZ_HINTS_EXT_ID_KEY: ''}
|
||||
self.l3_inst._ovn.create_lrouter.assert_called_once_with(
|
||||
'neutron-router-id', external_ids=external_ids,
|
||||
enabled=True, options={})
|
||||
enabled=True, options={'always_learn_from_arp_request': 'false',
|
||||
'dynamic_neigh_routers': 'true'})
|
||||
self.l3_inst._ovn.add_lrouter_port.assert_called_once_with(
|
||||
**self.fake_ext_gw_port_assert)
|
||||
expected_calls = [
|
||||
|
|
Loading…
Reference in New Issue