Merge "Just call set-manager if connecting fails"
This commit is contained in:
commit
5422cff844
@ -23,7 +23,6 @@ from ovs.db import idl
|
||||
from neutron.agent.ovsdb import api
|
||||
from neutron.agent.ovsdb.native import commands as cmd
|
||||
from neutron.agent.ovsdb.native import connection
|
||||
from neutron.agent.ovsdb.native import helpers
|
||||
from neutron.agent.ovsdb.native import idlutils
|
||||
from neutron.i18n import _LE
|
||||
|
||||
@ -123,11 +122,6 @@ class OvsdbIdl(api.API):
|
||||
|
||||
def __init__(self, context):
|
||||
super(OvsdbIdl, self).__init__(context)
|
||||
# it's a chicken and egg problem: by default, the manager that
|
||||
# corresponds to the connection URI is in most cases not enabled in
|
||||
# local ovsdb, so we still need ovs-vsctl to set it to allow
|
||||
# connections
|
||||
helpers.enable_connection_uri(self.ovsdb_connection.connection)
|
||||
OvsdbIdl.ovsdb_connection.start()
|
||||
self.idl = OvsdbIdl.ovsdb_connection.idl
|
||||
|
||||
|
@ -19,7 +19,9 @@ import traceback
|
||||
|
||||
from ovs.db import idl
|
||||
from ovs import poller
|
||||
import retrying
|
||||
|
||||
from neutron.agent.ovsdb.native import helpers
|
||||
from neutron.agent.ovsdb.native import idlutils
|
||||
|
||||
|
||||
@ -62,8 +64,21 @@ class Connection(object):
|
||||
if self.idl is not None:
|
||||
return
|
||||
|
||||
try:
|
||||
helper = idlutils.get_schema_helper(self.connection,
|
||||
self.schema_name)
|
||||
except Exception:
|
||||
# We may have failed do to set-manager not being called
|
||||
helpers.enable_connection_uri(self.connection)
|
||||
|
||||
# There is a small window for a race, so retry up to a second
|
||||
@retrying.retry(wait_exponential_multiplier=10,
|
||||
stop_max_delay=1000)
|
||||
def do_get_schema_helper():
|
||||
return idlutils.get_schema_helper(self.connection,
|
||||
self.schema_name)
|
||||
helper = do_get_schema_helper()
|
||||
|
||||
helper.register_all()
|
||||
self.idl = idl.Idl(self.connection, helper)
|
||||
idlutils.wait_for_change(self.idl, self.timeout)
|
||||
|
Loading…
Reference in New Issue
Block a user