From 6f7a915b9b63330d4dab44a986f9f79c08fbbfa3 Mon Sep 17 00:00:00 2001 From: zhhuabj Date: Tue, 14 Jul 2020 14:30:31 +0800 Subject: [PATCH] config option to set of_inactivity_probe This patch adds support for setting of-inactivity-probe in /etc/neutron/plugins/ml2/openvswitch_agent.ini [ovs] of_inactivity_probe = 10 Change-Id: Idb3ab6b0e82200226e3063065192b4346d0c5206 Closes-Bug: 1852582 --- config.yaml | 7 +++++++ hooks/neutron_ovs_context.py | 2 ++ templates/queens/openvswitch_agent.ini | 1 + unit_tests/test_neutron_ovs_context.py | 5 ++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index 5bbd22b2..451bf20d 100644 --- a/config.yaml +++ b/config.yaml @@ -403,3 +403,10 @@ options: option defines how frequently this check is performed. Setting this value to 0 will disable the healthchecks. Note that this only applies when using l3ha and dvr_snat. + of-inactivity-probe: + type: int + default: 10 + description: | + 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. The default value is 10 seconds. \ No newline at end of file diff --git a/hooks/neutron_ovs_context.py b/hooks/neutron_ovs_context.py index 7c42cb53..75c57f48 100644 --- a/hooks/neutron_ovs_context.py +++ b/hooks/neutron_ovs_context.py @@ -259,6 +259,8 @@ class OVSPluginContext(context.NeutronContext): if ovs_ctxt['firewall_driver'] != OPENVSWITCH: ovs_ctxt['enable_nsg_logging'] = False + ovs_ctxt['of_inactivity_probe'] = config('of-inactivity-probe') + return ovs_ctxt diff --git a/templates/queens/openvswitch_agent.ini b/templates/queens/openvswitch_agent.ini index 1cb9b75b..1305eb62 100644 --- a/templates/queens/openvswitch_agent.ini +++ b/templates/queens/openvswitch_agent.ini @@ -12,6 +12,7 @@ bridge_mappings = {{ bridge_mappings }} datapath_type = netdev vhostuser_socket_dir = /run/libvirt-vhost-user {% endif -%} +of_inactivity_probe = {{ of_inactivity_probe }} [agent] tunnel_types = {{ overlay_network_type }} diff --git a/unit_tests/test_neutron_ovs_context.py b/unit_tests/test_neutron_ovs_context.py index 8ef9b4f4..9c6dd772 100644 --- a/unit_tests/test_neutron_ovs_context.py +++ b/unit_tests/test_neutron_ovs_context.py @@ -134,7 +134,8 @@ class OVSPluginContextTest(CharmTestCase): 'security-group-log-output-base': '/var/log/nsg.log', 'security-group-log-rate-limit': None, 'security-group-log-burst-limit': 25, - 'keepalived-healthcheck-interval': 0} + 'keepalived-healthcheck-interval': 0, + 'of-inactivity-probe': 10} def mock_config(key=None): if key: @@ -193,6 +194,7 @@ class OVSPluginContextTest(CharmTestCase): 'nsg_log_rate_limit': None, 'nsg_log_burst_limit': 25, 'keepalived_healthcheck_interval': 0, + 'of_inactivity_probe': 10, } self.assertEqual(expect, napi_ctxt()) @@ -274,6 +276,7 @@ class OVSPluginContextTest(CharmTestCase): 'nsg_log_rate_limit': None, 'nsg_log_burst_limit': 25, 'keepalived_healthcheck_interval': 30, + 'of_inactivity_probe': 10, } self.maxDiff = None self.assertEqual(expect, napi_ctxt())