Merge "[OVS] Add mac-table-size to be set on each ovs bridge"

This commit is contained in:
Zuul 2018-06-13 23:22:25 +00:00 committed by Gerrit Code Review
commit 8700faa0d5
4 changed files with 35 additions and 0 deletions

View File

@ -260,6 +260,8 @@ class OVSBridge(BaseOVS):
key=version_from_protocol)
def create(self, secure_mode=False):
other_config = {
'mac-table-size': str(cfg.CONF.OVS.bridge_mac_table_size)}
with self.ovsdb.transaction() as txn:
txn.add(
self.ovsdb.add_br(self.br_name,
@ -271,6 +273,9 @@ class OVSBridge(BaseOVS):
txn.add(
self.ovsdb.db_add('Bridge', self.br_name,
'protocols', self._highest_protocol_needed))
txn.add(
self.ovsdb.db_set('Bridge', self.br_name,
('other_config', other_config)))
if secure_mode:
txn.add(self.ovsdb.set_fail_mode(self.br_name,
FAILMODE_SECURE))

View File

@ -27,6 +27,13 @@ OPTS = [
help=_('Timeout in seconds for ovsdb commands. '
'If the timeout expires, ovsdb commands will fail with '
'ALARMCLOCK error.')),
cfg.IntOpt('bridge_mac_table_size',
default=50000,
help=_('The maximum number of MAC addresses to learn on '
'a bridge managed by the Neutron OVS agent. Values '
'outside a reasonable range (10 to 1,000,000) might be '
'overridden by Open vSwitch according to the '
'documentation.')),
]

View File

@ -18,6 +18,7 @@ import uuid
import mock
from neutron_lib import constants as const
from oslo_config import cfg
from ovsdbapp.backend.ovs_idl import idlutils
from neutron.agent.common import ovs_lib
@ -603,6 +604,9 @@ class OVSLibTestCase(base.BaseOVSLinuxTestCase):
def test_bridge_lifecycle_ovsbridge(self):
name = utils.get_rand_name(prefix=net_helpers.BR_PREFIX)
mac_table_size = 12345
cfg.CONF.set_override(
'bridge_mac_table_size', mac_table_size, group='OVS')
br = ovs_lib.OVSBridge(name)
self.assertEqual(br.br_name, name)
# Make sure that instantiating an OVSBridge does not actually create
@ -610,6 +614,11 @@ class OVSLibTestCase(base.BaseOVSLinuxTestCase):
self.addCleanup(self.ovs.delete_bridge, name)
br.create()
self.assertTrue(self.ovs.bridge_exists(name))
br_other_config = self.ovs.ovsdb.db_find(
'Bridge', ('name', '=', name), columns=['other_config']
).execute()[0]['other_config']
self.assertEqual(str(mac_table_size),
br_other_config['mac-table-size'])
br.destroy()
self.assertFalse(self.ovs.bridge_exists(name))

View File

@ -0,0 +1,14 @@
---
features:
- |
A new config option ``bridge_mac_table_size`` has been added for
Neutron OVS agent.
This value will be set on every Open vSwitch bridge managed by the
openvswitch-neutron-agent in ``other_config:mac-table-size`` column
in ovsdb.
Default value for this new option is set to 50000 and it should be enough
for most systems.
More details about this option can be found in `Open vSwitch documentation
<http://www.openvswitch.org/support/dist-docs/ovs-vswitchd.conf.db.5.html>`_
For more information see bug
`1775797 <https://bugs.launchpad.net/neutron/+bug/1775797>`_.