Acked-by: Daniel Alvarez <[email protected]>

Looks good to me. Just a minor comment in case you need to submit another
version of the patch: comments say that it will default to at least 1000
ms. In fact,
it'll default to OVS minimum default value. If this changes at some point
(unlikely),
then your comments shall change too.

On Tue, Apr 11, 2017 at 5:00 PM, Lucas Alvares Gomes <[email protected]>
wrote:

> 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 <[email protected]>
> ---
>  python/ovs/db/idl.py  | 12 +++++++++---
>  python/ovs/jsonrpc.py | 11 +++++++++--
>  2 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
> index 079a03ba1..60548bcf5 100644
> --- a/python/ovs/db/idl.py
> +++ b/python/ovs/db/idl.py
> @@ -94,7 +94,7 @@ class Idl(object):
>      IDL_S_MONITOR_REQUESTED = 1
>      IDL_S_MONITOR_COND_REQUESTED = 2
>
> -    def __init__(self, remote, schema):
> +    def __init__(self, remote, schema, probe_interval=None):
>          """Creates and returns a connection to the database named
> 'db_name' on
>          'remote', which should be in a form acceptable to
>          ovs.jsonrpc.session.open().  The connection will maintain an
> in-memory
> @@ -112,7 +112,12 @@ class Idl(object):
>          As a convenience to users, 'schema' may also be an instance of the
>          SchemaHelper class.
>
> -        The IDL uses and modifies 'schema' directly."""
> +        The IDL uses and modifies 'schema' directly.
> +
> +        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.
> +        """
>
>          assert isinstance(schema, SchemaHelper)
>          schema = schema.get_idl_schema()
> @@ -120,7 +125,8 @@ class Idl(object):
>          self.tables = schema.tables
>          self.readonly = schema.readonly
>          self._db = schema
> -        self._session = ovs.jsonrpc.Session.open(remote)
> +        self._session = ovs.jsonrpc.Session.open(remote,
> +            probe_interval=probe_interval)
>          self._monitor_request_id = None
>          self._last_seqno = None
>          self.change_seqno = 0
> diff --git a/python/ovs/jsonrpc.py b/python/ovs/jsonrpc.py
> index 69f7abeb8..09e9c8b0a 100644
> --- a/python/ovs/jsonrpc.py
> +++ b/python/ovs/jsonrpc.py
> @@ -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)
>
> --
> 2.12.2
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to