From 3ff1e33f2b3fb9e50acfdf60f82a962fc2c94836 Mon Sep 17 00:00:00 2001 From: Rodolfo Alonso Hernandez Date: Fri, 17 Apr 2020 17:23:47 +0000 Subject: [PATCH] Add "inactivity_probe" parameter to "enable_connection_uri" Added "inactivity_probe" parameter (milliseconds) to the set manager command. The command timeout and the manager inactivity probe are now two different parameters. This patch also solves a problem related with the kwargs passed to the command executor. Both related parameters, "timeout" and "inactivity_probe" are removed first from this dictionary. This function is, at the present time, only called once from Neutron. Change-Id: I7818c5b60eabca08963c623dd131784791b7dc37 Related-Bug: #1868686 --- ovsdbapp/schema/open_vswitch/helpers.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ovsdbapp/schema/open_vswitch/helpers.py b/ovsdbapp/schema/open_vswitch/helpers.py index 435980ba..07cf3f11 100644 --- a/ovsdbapp/schema/open_vswitch/helpers.py +++ b/ovsdbapp/schema/open_vswitch/helpers.py @@ -29,13 +29,17 @@ def _connection_to_manager_uri(conn_uri): # TODO(jlibosva): Get rid of this runtime configuration and raise a message to # set Manager outside of ovsdbapp. def enable_connection_uri(conn_uri, execute=None, **kwargs): - timeout = kwargs.get('timeout', 5) - probe = timeout if kwargs.get('set_timeout') else None + timeout = kwargs.pop('timeout', 5) + # NOTE(ralonsoh): the command timeout , "timeout", is defined in seconds; + # the probe timeout is defined in milliseconds. If "timeout" is used, must + # be converted to ms. + probe = (timeout * 1000 if kwargs.pop('set_timeout', None) else + kwargs.pop('inactivity_probe', None)) man_uri = _connection_to_manager_uri(conn_uri) cmd = ['ovs-vsctl', '--timeout=%d' % timeout, '--id=@manager', '--', 'create', 'Manager', 'target="%s"' % man_uri, '--', 'add', 'Open_vSwitch', '.', 'manager_options', '@manager'] - if probe: + if probe is not None: cmd += ['--', 'set', 'Manager', man_uri, 'inactivity_probe=%s' % probe] if execute: return execute(cmd, **kwargs).rstrip()