diff --git a/neutron/agent/common/ovs_lib.py b/neutron/agent/common/ovs_lib.py index 5f15ecc1a5b..f34db739116 100644 --- a/neutron/agent/common/ovs_lib.py +++ b/neutron/agent/common/ovs_lib.py @@ -682,6 +682,13 @@ class OVSBridge(BaseOVS): """ self.set_controller_field('connection_mode', connection_mode) + def set_controllers_inactivity_probe(self, interval): + """Set bridge controllers inactivity probe interval. + + :param interval: inactivity_probe value in seconds. + """ + self.set_controller_field('inactivity_probe', interval * 1000) + def _set_egress_bw_limit_for_port(self, port_name, max_kbps, max_burst_kbps): with self.ovsdb.transaction(check_error=True) as txn: diff --git a/neutron/conf/plugins/ml2/drivers/ovs_conf.py b/neutron/conf/plugins/ml2/drivers/ovs_conf.py index 929890a188e..1757bb88d1d 100644 --- a/neutron/conf/plugins/ml2/drivers/ovs_conf.py +++ b/neutron/conf/plugins/ml2/drivers/ovs_conf.py @@ -93,6 +93,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 = [ diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge.py b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge.py index f639cd47f66..96a659d738a 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge.py @@ -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) diff --git a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge_test_base.py b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge_test_base.py index ced3df2d795..d5cef0e5a3f 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge_test_base.py +++ b/neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge_test_base.py @@ -142,12 +142,15 @@ 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: - self.br.setup_controllers(cfg) - set_ccm.assert_called_once_with("out-of-band") + 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") class OVSDVRProcessTestMixin(object): diff --git a/releasenotes/notes/ovs-make-inactivity-probe-configurable-39d669014d961c5c.yaml b/releasenotes/notes/ovs-make-inactivity-probe-configurable-39d669014d961c5c.yaml new file mode 100644 index 00000000000..3467854f79a --- /dev/null +++ b/releasenotes/notes/ovs-make-inactivity-probe-configurable-39d669014d961c5c.yaml @@ -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.