summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-06-13 23:22:25 +0000
committerGerrit Code Review <review@openstack.org>2018-06-13 23:22:25 +0000
commit8700faa0d53fe6fc2383ff86a76035fcecba6fdf (patch)
tree139f030587453da078773a78a6d7cb037908d902
parentebf1d3d804a7883a0b53cd41821fe590753fc62a (diff)
parent1f8378e0ac4b8c3fc4670144e6efc51940d796ad (diff)
Merge "[OVS] Add mac-table-size to be set on each ovs bridge"
-rw-r--r--neutron/agent/common/ovs_lib.py5
-rw-r--r--neutron/conf/agent/ovs_conf.py7
-rw-r--r--neutron/tests/functional/agent/test_ovs_lib.py9
-rw-r--r--releasenotes/notes/ovs-mac-table-size-config-option-d255d5208650f34b.yaml14
4 files changed, 35 insertions, 0 deletions
diff --git a/neutron/agent/common/ovs_lib.py b/neutron/agent/common/ovs_lib.py
index 63aa6f8..0c2a911 100644
--- a/neutron/agent/common/ovs_lib.py
+++ b/neutron/agent/common/ovs_lib.py
@@ -260,6 +260,8 @@ class OVSBridge(BaseOVS):
260 key=version_from_protocol) 260 key=version_from_protocol)
261 261
262 def create(self, secure_mode=False): 262 def create(self, secure_mode=False):
263 other_config = {
264 'mac-table-size': str(cfg.CONF.OVS.bridge_mac_table_size)}
263 with self.ovsdb.transaction() as txn: 265 with self.ovsdb.transaction() as txn:
264 txn.add( 266 txn.add(
265 self.ovsdb.add_br(self.br_name, 267 self.ovsdb.add_br(self.br_name,
@@ -271,6 +273,9 @@ class OVSBridge(BaseOVS):
271 txn.add( 273 txn.add(
272 self.ovsdb.db_add('Bridge', self.br_name, 274 self.ovsdb.db_add('Bridge', self.br_name,
273 'protocols', self._highest_protocol_needed)) 275 'protocols', self._highest_protocol_needed))
276 txn.add(
277 self.ovsdb.db_set('Bridge', self.br_name,
278 ('other_config', other_config)))
274 if secure_mode: 279 if secure_mode:
275 txn.add(self.ovsdb.set_fail_mode(self.br_name, 280 txn.add(self.ovsdb.set_fail_mode(self.br_name,
276 FAILMODE_SECURE)) 281 FAILMODE_SECURE))
diff --git a/neutron/conf/agent/ovs_conf.py b/neutron/conf/agent/ovs_conf.py
index c0cdd24..f81d20f 100644
--- a/neutron/conf/agent/ovs_conf.py
+++ b/neutron/conf/agent/ovs_conf.py
@@ -27,6 +27,13 @@ OPTS = [
27 help=_('Timeout in seconds for ovsdb commands. ' 27 help=_('Timeout in seconds for ovsdb commands. '
28 'If the timeout expires, ovsdb commands will fail with ' 28 'If the timeout expires, ovsdb commands will fail with '
29 'ALARMCLOCK error.')), 29 'ALARMCLOCK error.')),
30 cfg.IntOpt('bridge_mac_table_size',
31 default=50000,
32 help=_('The maximum number of MAC addresses to learn on '
33 'a bridge managed by the Neutron OVS agent. Values '
34 'outside a reasonable range (10 to 1,000,000) might be '
35 'overridden by Open vSwitch according to the '
36 'documentation.')),
30] 37]
31 38
32 39
diff --git a/neutron/tests/functional/agent/test_ovs_lib.py b/neutron/tests/functional/agent/test_ovs_lib.py
index 94d73d4..331c3e8 100644
--- a/neutron/tests/functional/agent/test_ovs_lib.py
+++ b/neutron/tests/functional/agent/test_ovs_lib.py
@@ -18,6 +18,7 @@ import uuid
18 18
19import mock 19import mock
20from neutron_lib import constants as const 20from neutron_lib import constants as const
21from oslo_config import cfg
21from ovsdbapp.backend.ovs_idl import idlutils 22from ovsdbapp.backend.ovs_idl import idlutils
22 23
23from neutron.agent.common import ovs_lib 24from neutron.agent.common import ovs_lib
@@ -603,6 +604,9 @@ class OVSLibTestCase(base.BaseOVSLinuxTestCase):
603 604
604 def test_bridge_lifecycle_ovsbridge(self): 605 def test_bridge_lifecycle_ovsbridge(self):
605 name = utils.get_rand_name(prefix=net_helpers.BR_PREFIX) 606 name = utils.get_rand_name(prefix=net_helpers.BR_PREFIX)
607 mac_table_size = 12345
608 cfg.CONF.set_override(
609 'bridge_mac_table_size', mac_table_size, group='OVS')
606 br = ovs_lib.OVSBridge(name) 610 br = ovs_lib.OVSBridge(name)
607 self.assertEqual(br.br_name, name) 611 self.assertEqual(br.br_name, name)
608 # Make sure that instantiating an OVSBridge does not actually create 612 # Make sure that instantiating an OVSBridge does not actually create
@@ -610,6 +614,11 @@ class OVSLibTestCase(base.BaseOVSLinuxTestCase):
610 self.addCleanup(self.ovs.delete_bridge, name) 614 self.addCleanup(self.ovs.delete_bridge, name)
611 br.create() 615 br.create()
612 self.assertTrue(self.ovs.bridge_exists(name)) 616 self.assertTrue(self.ovs.bridge_exists(name))
617 br_other_config = self.ovs.ovsdb.db_find(
618 'Bridge', ('name', '=', name), columns=['other_config']
619 ).execute()[0]['other_config']
620 self.assertEqual(str(mac_table_size),
621 br_other_config['mac-table-size'])
613 br.destroy() 622 br.destroy()
614 self.assertFalse(self.ovs.bridge_exists(name)) 623 self.assertFalse(self.ovs.bridge_exists(name))
615 624
diff --git a/releasenotes/notes/ovs-mac-table-size-config-option-d255d5208650f34b.yaml b/releasenotes/notes/ovs-mac-table-size-config-option-d255d5208650f34b.yaml
new file mode 100644
index 0000000..1294c11
--- /dev/null
+++ b/releasenotes/notes/ovs-mac-table-size-config-option-d255d5208650f34b.yaml
@@ -0,0 +1,14 @@
1---
2features:
3 - |
4 A new config option ``bridge_mac_table_size`` has been added for
5 Neutron OVS agent.
6 This value will be set on every Open vSwitch bridge managed by the
7 openvswitch-neutron-agent in ``other_config:mac-table-size`` column
8 in ovsdb.
9 Default value for this new option is set to 50000 and it should be enough
10 for most systems.
11 More details about this option can be found in `Open vSwitch documentation
12 <http://www.openvswitch.org/support/dist-docs/ovs-vswitchd.conf.db.5.html>`_
13 For more information see bug
14 `1775797 <https://bugs.launchpad.net/neutron/+bug/1775797>`_.