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
This commit is contained in:
parent
3b3398b8c5
commit
f9bda4b1e4
@ -78,7 +78,7 @@ oslo.versionedobjects==1.35.1
|
|||||||
oslotest==3.2.0
|
oslotest==3.2.0
|
||||||
osprofiler==2.3.0
|
osprofiler==2.3.0
|
||||||
ovs==2.10.0
|
ovs==2.10.0
|
||||||
ovsdbapp==1.7.0
|
ovsdbapp==1.10.0
|
||||||
packaging==20.4
|
packaging==20.4
|
||||||
Paste==2.0.2
|
Paste==2.0.2
|
||||||
PasteDeploy==1.5.0
|
PasteDeploy==1.5.0
|
||||||
|
@ -39,6 +39,7 @@ from neutron.services.portforwarding import constants as pf_const
|
|||||||
|
|
||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
|
DEFAULT_LOOKUP_TIMEOUT = 2
|
||||||
|
|
||||||
|
|
||||||
# Override wait_for_change to not use a timeout so we always try to reconnect
|
# 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})
|
% {'match': match, 'column': column, 'table': table})
|
||||||
raise RuntimeError(msg)
|
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):
|
class OvsdbConnectionUnavailable(n_exc.ServiceUnavailable):
|
||||||
message = _("OVS database connection to %(db_schema)s failed with error: "
|
message = _("OVS database connection to %(db_schema)s failed with error: "
|
||||||
|
@ -45,7 +45,7 @@ oslo.versionedobjects>=1.35.1 # Apache-2.0
|
|||||||
osprofiler>=2.3.0 # Apache-2.0
|
osprofiler>=2.3.0 # Apache-2.0
|
||||||
os-ken >= 0.3.0 # Apache-2.0
|
os-ken >= 0.3.0 # Apache-2.0
|
||||||
ovs>=2.10.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
|
packaging>=20.4 # Apache-2.0
|
||||||
psutil>=5.3.0 # BSD
|
psutil>=5.3.0 # BSD
|
||||||
pyroute2>=0.5.13;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2)
|
pyroute2>=0.5.13;sys_platform!='win32' # Apache-2.0 (+ dual licensed GPL2)
|
||||||
|
Loading…
Reference in New Issue
Block a user