Browse Source

Set the default ``Backend.lookup`` timeout to 2 seconds

In order to broadly cover the issue described in the referred bug,
this patch sets a default timeout of 2 seconds in the
``ovs_idl.Backend.lookup`` method.

This timeout should cover most of the situations where the IDL local
cache update is delayed. This patch does not change the default
behavior, except it will not fail if the DB cache is synchronized
within 2 seconds.

If we don't pass the notify handler or the backend does not implement
one, in case of not finding the requested register, the method will
raise like before.

ovsdbapp library is bumped to version 1.10.0 to receive the change
that introduces the active wait in ``Backend.lookup`` and adds the
timeout parameter to the method signature.

Change-Id: Ib40eabd6a8e9d59896e0e20383d8061eb4b5c710
Related-Bug: #1922934
changes/12/790912/3
Rodolfo Alonso Hernandez 4 months ago
committed by Rodolfo Alonso
parent
commit
f9bda4b1e4
  1. 2
      lower-constraints.txt
  2. 6
      neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/impl_idl_ovn.py
  3. 2
      requirements.txt

2
lower-constraints.txt

@ -78,7 +78,7 @@ oslo.versionedobjects==1.35.1
oslotest==3.2.0
osprofiler==2.3.0
ovs==2.10.0
ovsdbapp==1.7.0
ovsdbapp==1.10.0
packaging==20.4
Paste==2.0.2
PasteDeploy==1.5.0

6
neutron/plugins/ml2/drivers/ovn/mech_driver/ovsdb/impl_idl_ovn.py

@ -39,6 +39,7 @@ from neutron.services.portforwarding import constants as pf_const
LOG = log.getLogger(__name__)
DEFAULT_LOOKUP_TIMEOUT = 2
# Override wait_for_change to not use a timeout so we always try to reconnect
@ -150,6 +151,11 @@ class Backend(ovs_idl.Backend):
% {'match': match, 'column': column, 'table': table})
raise RuntimeError(msg)
def lookup(self, table, record, default=ovs_idl._NO_DEFAULT,
timeout=DEFAULT_LOOKUP_TIMEOUT, notify_handler=None):
return super().lookup(table, record, default=default, timeout=timeout,
notify_handler=notify_handler)
class OvsdbConnectionUnavailable(n_exc.ServiceUnavailable):
message = _("OVS database connection to %(db_schema)s failed with error: "

2
requirements.txt

@ -45,7 +45,7 @@ oslo.versionedobjects>=1.35.1 # Apache-2.0
osprofiler>=2.3.0 # Apache-2.0
os-ken >= 0.3.0 # Apache-2.0
ovs>=2.10.0 # Apache-2.0
ovsdbapp>=1.7.0 # Apache-2.0
ovsdbapp>=1.10.0 # Apache-2.0
packaging>=20.4 # Apache-2.0
psutil>=5.3.0 # BSD
pyroute2>=0.5.13;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2)

Loading…
Cancel
Save