def __init__(self, driver, trigger=None): super(OvsdbNbOvnIdl, self).__init__() try: if OvsdbNbOvnIdl.ovsdb_connection is None: OvsdbNbOvnIdl.ovsdb_connection = get_connection( OvsdbNbOvnIdl, trigger) if isinstance(OvsdbNbOvnIdl.ovsdb_connection, ovsdb_monitor.OvnConnection): OvsdbNbOvnIdl.ovsdb_connection.start(driver) else: OvsdbNbOvnIdl.ovsdb_connection.start() self.idl = OvsdbNbOvnIdl.ovsdb_connection.idl self.ovsdb_timeout = cfg.get_ovn_ovsdb_timeout() # FIXME(lucasagomes): We should not access the _session # private attribute like this, ideally the IDL class would # expose a public method to allow others to tune the probe # interval. This shoule be done in the OVS python library. self.idl._session.reconnect.set_probe_interval( cfg.get_ovn_ovsdb_probe_interval()) except Exception as e: connection_exception = OvsdbConnectionUnavailable( db_schema='OVN_Northbound', error=e) LOG.exception(connection_exception) raise connection_exception
def start(self): connection_string = config.cfg.CONF.ovs.ovsdb_connection helper = idlutils.get_schema_helper(connection_string, 'Open_vSwitch') tables = ('Open_vSwitch', 'Bridge', 'Port', 'Interface') for table in tables: helper.register_table(table) ovs_idl = idl.Idl(connection_string, helper) ovs_idl._session.reconnect.set_probe_interval( config.get_ovn_ovsdb_probe_interval()) conn = connection.Connection( ovs_idl, timeout=config.cfg.CONF.ovs.ovsdb_connection_timeout) return idl_ovs.OvsdbIdl(conn)
def __init__(self, connection): super(OvsdbSbOvnIdl, self).__init__(connection) # TODO(twilson) This direct access of the idl should be removed in # favor of a backend-agnostic method self.idl._session.reconnect.set_probe_interval( cfg.get_ovn_ovsdb_probe_interval())
def __init__(self, connection): super(OvsdbNbOvnIdl, self).__init__(connection) self.idl._session.reconnect.set_probe_interval( cfg.get_ovn_ovsdb_probe_interval())