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
(cherry picked from commit 3ff1e33f2b)
(cherry picked from commit bdf697a1a0)
(cherry picked from commit 9bb0eee286)
This commit is contained in:
Rodolfo Alonso Hernandez 2020-04-17 17:23:47 +00:00
parent 8b8d15b909
commit 1cb33fa2d0
1 changed files with 7 additions and 3 deletions

View File

@ -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()