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
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
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
if self.idl is not None:
return
- helper = idlutils.get_schema_helper(self.connection,
- self.schema_name)
+ 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)