Merge "Don't ever give up trying to connect to OVN DBs" into stable/ussuri

This commit is contained in:
Zuul 2021-05-06 22:58:30 +00:00 committed by Gerrit Code Review
commit 23fa126bc1
2 changed files with 34 additions and 0 deletions

View File

@ -39,6 +39,19 @@ from neutron.plugins.ml2.drivers.ovn.mech_driver.ovsdb import worker
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):

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
from ovsdbapp.tests import utils
@ -147,3 +148,23 @@ 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,
n_base.BaseLoggingTestCase):
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