Browse Source

Don't ever give up trying to connect to OVN DBs

It doesn't really make since to give up connectimg to the OVN DBs
since we can't do anything without them. If ovsdb-server is slow
and takes more than timeout seconds, everything reconnecting after
partial downloads and starting over is not going to make things
better.

We can change the behavior in ovsdbapp, but doing it without
making non-backportable API changes isn't easily doable.
The plan would be, after merging this back through stable, to
modify ovsdbapp to allow setting different connection and txn
timeouts and being able to disable the timeout in wait_for_change
with a value of -1. Then in the main branch of neutron we can
use that going forward.

Closes-Bug: #1926653

Conflicts:
networking_ovn/tests/functional/test_impl_idl.py

Change-Id: Ia9e23113fdeebf0b99085da200c3d61b71567d36
(cherry picked from neutron commit 39ccc0d6d6)
changes/91/788591/6
Terry Wilson 2 months ago
committed by Flavio Fernandes
parent
commit
e4ca6a624b
2 changed files with 33 additions and 0 deletions
  1. +13
    -0
      networking_ovn/ovsdb/impl_idl_ovn.py
  2. +20
    -0
      networking_ovn/tests/functional/test_impl_idl.py

+ 13
- 0
networking_ovn/ovsdb/impl_idl_ovn.py View File

@ -38,6 +38,19 @@ from networking_ovn.ovsdb import ovsdb_monitor
LOG = log.getLogger(__name__)
# Override wait_for_change to not use a timeout so we always try to reconnect
def wait_for_change(idl_, timeout, seqno=None):
if seqno is None:
seqno = idl_.change_seqno
while idl_.change_seqno == seqno and not idl_.run():
poller = idlutils.poller.Poller()
idl_.wait(poller)
poller.block()
idlutils.wait_for_change = wait_for_change
class OvnNbTransaction(idl_trans.Transaction):
def __init__(self, *args, **kwargs):


+ 20
- 0
networking_ovn/tests/functional/test_impl_idl.py View File

@ -14,6 +14,7 @@
import uuid
from ovsdbapp.backend.ovs_idl import connection
from ovsdbapp import event as ovsdb_event
from ovsdbapp.tests.functional import base
@ -157,3 +158,22 @@ class TestSbApi(base.FunctionalTestCase):
self.assertEqual(
(chassis.name, str(binding.datapath.uuid)),
self.api.get_logical_port_chassis_and_datapath(port.name))
class TestIgnoreConnectionTimeout(base.FunctionalTestCase):
schemas = ['OVN_Southbound', 'OVN_Northbound']
def setUp(self):
super(TestIgnoreConnectionTimeout, self).setUp()
self.api = impl.OvsdbSbOvnIdl(self.connection['OVN_Southbound'])
self.nbapi = impl.OvsdbNbOvnIdl(self.connection['OVN_Northbound'])
self.handler = ovsdb_event.RowEventHandler()
self.api.idl.notify = self.handler.notify
@classmethod
def create_connection(cls, schema):
idl = connection.OvsdbIdl.from_server(cls.schema_map[schema], schema)
return connection.Connection(idl, 0)
def test_setUp_will_fail_if_this_is_broken(self):
pass

Loading…
Cancel
Save