2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-29 15:28:56 +00:00

python: Allow tuning the session probe_interval from IDL

This patch is adding a new parameter called "probe_interval" to the
constructor of the Idl class. This new parameter will be used to tune
the database connection probing for that IDL session, some users might
want to tune it to be less agressive than the current 5s default in OVS
or even disable it.

Reported-at: https://bugs.launchpad.net/networking-ovn/+bug/1680146
Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Acked-by: Daniel Alvarez <dalvarez@redhat.com>
Signed-off-by: Russell Bryant <russell@ovn.org>
This commit is contained in:
Lucas Alvares Gomes
2017-04-11 16:00:31 +01:00
committed by Russell Bryant
parent 6bee868926
commit f73d562fc0
3 changed files with 19 additions and 5 deletions

View File

@@ -376,7 +376,7 @@ class Session(object):
self.seqno = 0
@staticmethod
def open(name):
def open(name, probe_interval=None):
"""Creates and returns a Session that maintains a JSON-RPC session to
'name', which should be a string acceptable to ovs.stream.Stream or
ovs.stream.PassiveStream's initializer.
@@ -387,7 +387,12 @@ class Session(object):
If 'name' is a passive connection method, e.g. "ptcp:", the new session
listens for connections to 'name'. It maintains at most one connection
at any given time. Any new connection causes the previous one (if any)
to be dropped."""
to be dropped.
If "probe_interval" is zero it disables the connection keepalive
feature. If non-zero the value will be forced to at least 1000
milliseconds. If None it will just use the default value in OVS.
"""
reconnect = ovs.reconnect.Reconnect(ovs.timeval.msec())
reconnect.set_name(name)
reconnect.enable(ovs.timeval.msec())
@@ -397,6 +402,8 @@ class Session(object):
if not ovs.stream.stream_or_pstream_needs_probes(name):
reconnect.set_probe_interval(0)
elif probe_interval is not None:
reconnect.set_probe_interval(probe_interval)
return Session(reconnect, None)