From 88aa5c9184f8f448aed499413cda51188d66c7a6 Mon Sep 17 00:00:00 2001 From: Numan Siddique Date: Wed, 4 Jul 2018 15:12:39 +0530 Subject: [PATCH] Set mac-table-size for provider bridges defined in 'ovn_bridge_mappings' The default mac table size may not be sufficient for the provider bridges. If the mac table overflows, it has been observed that ovs-vswitchd clocks 100% CPU. So this patch configures the mac table size of the provider bridges. It defaults to 50000 if the value is not specified. This patch also clears the ovn-bridge-mappings property from the OpenvSwitch's default tables row's external_ids column if 'bridge_interface_mappings' param is not set. Change-Id: I8f392c7807c4c6a152dfa4b77c7f4350b44324c0 Closes-bug: #1779706 Closes-bug: #1774847 --- manifests/controller.pp | 31 +++++++++++++++++++++++++++++ spec/classes/ovn_controller_spec.rb | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/manifests/controller.pp b/manifests/controller.pp index 823b635..9811995 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -38,6 +38,11 @@ # Hardware Offload. This feature is # supported from ovs 2.8.0. # Defaults to False. +# +# [*mac_table_size*] +# Set the mac table size for the provider bridges if defined in ovn_bridge_mappings +# Defaults to 50000 + class ovn::controller( $ovn_remote, $ovn_encap_ip, @@ -47,6 +52,7 @@ class ovn::controller( $hostname = $::fqdn, $ovn_bridge = 'br-int', $enable_hw_offload = false, + $mac_table_size = 50000, ) { include ::ovn::params include ::vswitch::ovs @@ -103,4 +109,29 @@ class ovn::controller( create_resources('vs_config', merge($config_items, $bridge_items, $hw_offload)) Service['openvswitch'] -> Vs_config<||> -> Service['controller'] + + if !empty($ovn_bridge_mappings) { + # For each provider bridge, set the mac table size. + $ovn_bridge_mappings.each |String $mappings| { + $mapping = split($mappings, ':') + $br = $mapping[1] + if !empty($br) { + # TODO(numans): Right now puppet-vswitch's vs_bridge doesn't support + # setting the column 'other-config' for the Bridge table. + # Switch to using vs_bridge once the support is available. + exec { $br: + command => "ovs-vsctl --timeout=5 set Bridge ${br} other-config:mac-table-size=${mac_table_size}", + unless => "ovs-vsctl get bridge ${br} other-config:mac-table-size | grep -q -w ${mac_table_size}", + path => '/usr/sbin:/usr/bin:/sbin:/bin', + require => Service['openvswitch'] + } + } + } + } else { + # ovn-bridge-mappings is not defined. Clear the existing value if configured. + vs_config { 'external_ids:ovn-bridge-mappings': + ensure => absent, + require => Service['openvswitch'] + } + } } diff --git a/spec/classes/ovn_controller_spec.rb b/spec/classes/ovn_controller_spec.rb index 1b42bf4..1057546 100644 --- a/spec/classes/ovn_controller_spec.rb +++ b/spec/classes/ovn_controller_spec.rb @@ -10,7 +10,8 @@ describe 'ovn::controller' do :ovn_bridge => 'br-int', :bridge_interface_mappings => ['br-1:eth1'], :hostname => 'server1.example.com', - :enable_hw_offload => false + :enable_hw_offload => false, + :mac_table_size => 20000 } end