Make OVS controller inactivity_probe configurable

This parameter applies to the OVSDB Controller table when the
native openflow driver is used. There are reports that increasing
it can reduce errors on busy systems. This patch also sets the
default value to 10s which is more than the OVS default of 5s.
See the ovs-vswitchd.conf.db man page for full description.

Conflicts:
    neutron/tests/functional/agent/common/test_ovs_lib.py
    neutron/agent/common/ovs_lib.py

Change-Id: If0d42919412dac75deb4d7f484c42cea630fbc59
Partial-Bug: #1817022
(cherry picked from commit 540d00f68e)
(cherry picked from commit 6e661ecd2d)
(cherry picked from commit eaad77758d)
(cherry picked from commit 7891c7cd05)
This commit is contained in:
Darragh O'Reilly 2019-03-07 14:33:26 +00:00 committed by Antonio Ojea
parent 4bdd17a743
commit 4ba9f694c6
5 changed files with 33 additions and 3 deletions

View File

@ -662,6 +662,20 @@ class OVSBridge(BaseOVS):
txn.add(self.ovsdb.db_set('Controller',
controller_uuid, *attr))
def set_controllers_inactivity_probe(self, interval):
"""Set bridge controllers inactivity probe interval.
:param interval: inactivity_probe value in seconds.
"""
attr = [('inactivity_probe', interval * 1000)]
controllers = self.db_get_val('Bridge', self.br_name, 'controller')
controllers = [controllers] if isinstance(
controllers, uuid.UUID) else controllers
with self.ovsdb.transaction(check_error=True) as txn:
for controller_uuid in controllers:
txn.add(self.ovsdb.db_set('Controller',
controller_uuid, *attr))
def _set_egress_bw_limit_for_port(self, port_name, max_kbps,
max_burst_kbps):
with self.ovsdb.transaction(check_error=True) as txn:

View File

@ -94,6 +94,11 @@ ovs_opts = [
help=_("Timeout in seconds to wait for a single "
"OpenFlow request. "
"Used only for 'native' driver.")),
cfg.IntOpt('of_inactivity_probe', default=10,
help=_("The inactivity_probe interval in seconds for the local "
"switch connection to the controller. "
"A value of 0 disables inactivity probes. "
"Used only for 'native' driver.")),
]
agent_opts = [

View File

@ -93,6 +93,7 @@ class OVSAgentBridge(ofswitch.OpenFlowSwitchMixin,
#
# [1] https://github.com/openvswitch/ovs/blob/master/DESIGN.md
self.set_controllers_connection_mode("out-of-band")
self.set_controllers_inactivity_probe(conf.OVS.of_inactivity_probe)
def drop_port(self, in_port):
self.install_drop(priority=2, in_port=in_port)

View File

@ -138,10 +138,13 @@ class OVSBridgeTestBase(ovs_test_base.OVSRyuTestBase):
m_add_protocols = mock.patch.object(self.br, 'add_protocols')
m_set_controller = mock.patch.object(self.br, 'set_controller')
m_set_probe = mock.patch.object(self.br,
'set_controllers_inactivity_probe')
m_set_ccm = mock.patch.object(self.br,
'set_controllers_connection_mode')
with m_set_ccm as set_ccm, m_set_controller, m_add_protocols:
with m_set_ccm as set_ccm:
with m_set_controller, m_add_protocols, m_set_probe:
self.br.setup_controllers(cfg)
set_ccm.assert_called_once_with("out-of-band")

View File

@ -0,0 +1,7 @@
---
other:
- |
A new option ``[ovs] of_inactivity_probe`` has been added to allow
changing the inactivity probe interval when using the OVS ML2 agent
with the native OpenFlow driver. Operators can increase this if they
are experiencing OpenFlow timeouts. The default value is 10 seconds.