def __init__(self, driver, remote, schema): super(OvnInitPGNbIdl, self).__init__(driver, remote, schema) self.set_table_condition( 'Port_Group', [['name', '==', ovn_const.OVN_DROP_PORT_GROUP_NAME]]) self.neutron_pg_drop_event = NeutronPgDropPortGroupCreated( timeout=ovn_conf.get_ovn_ovsdb_timeout()) self.notify_handler.watch_event(self.neutron_pg_drop_event)
def from_worker(cls, worker_class, driver=None): args = (cfg.get_ovn_sb_connection(), 'OVN_Southbound') if worker_class == worker.MaintenanceWorker: idl_ = ovsdb_monitor.BaseOvnSbIdl.from_server(*args) else: idl_ = ovsdb_monitor.OvnSbIdl.from_server(*args, driver=driver) conn = connection.Connection(idl_, timeout=cfg.get_ovn_ovsdb_timeout()) return cls(conn)
def from_worker(cls, worker_class, driver=None): args = (cls.connection_string, cls.schema_helper) if worker_class == worker.MaintenanceWorker: idl_ = ovsdb_monitor.BaseOvnSbIdl.from_server(*args) else: idl_ = ovsdb_monitor.OvnSbIdl.from_server(*args, driver=driver) conn = connection.Connection(idl_, timeout=cfg.get_ovn_ovsdb_timeout()) return cls(conn)
def __init__(self, driver, remote, schema): super(OvnInitPGNbIdl, self).__init__(driver, remote, schema) # self.cond_change() doesn't work here because we are setting the # condition *before an initial monitor request is made* so there is # no previous session whose condition we wish to change self.tables['Port_Group'].condition = [ ['name', '==', ovn_const.OVN_DROP_PORT_GROUP_NAME]] self.neutron_pg_drop_event = NeutronPgDropPortGroupCreated( timeout=ovn_conf.get_ovn_ovsdb_timeout()) self.notify_handler.watch_event(self.neutron_pg_drop_event)
def short_living_ovsdb_api(api_class, idl): """Context manager for short living connections to the database. :param api_class: Class implementing the database calls (e.g. from the impl_idl module) :param idl: An instance of IDL class (e.g. instance of OvnNbIdl) """ conn = connection.Connection(idl, timeout=ovn_conf.get_ovn_ovsdb_timeout()) api = api_class(conn) try: yield api finally: api.ovsdb_connection.stop()
def get_connection(db_class, trigger=None, driver=None, binding_events=False): if db_class == OvsdbNbOvnIdl: args = (cfg.get_ovn_nb_connection(), 'OVN_Northbound') elif db_class == OvsdbSbOvnIdl: args = (cfg.get_ovn_sb_connection(), 'OVN_Southbound') if binding_events: if db_class == OvsdbNbOvnIdl: idl_ = ovsdb_monitor.OvnNbIdl.from_server(*args, driver=driver) else: idl_ = ovsdb_monitor.OvnSbIdl.from_server(*args, driver=driver) else: if db_class == OvsdbNbOvnIdl: idl_ = ovsdb_monitor.BaseOvnIdl.from_server(*args) else: idl_ = ovsdb_monitor.BaseOvnSbIdl.from_server(*args) return connection.Connection(idl_, timeout=cfg.get_ovn_ovsdb_timeout())
def start(self): LOG.info('Getting OvsdbSbOvnIdl for MetadataAgent with retry') conn = connection.Connection(self, timeout=config.get_ovn_ovsdb_timeout()) return impl_idl_ovn.OvsdbSbOvnIdl(conn)
def start(self): conn = connection.Connection(self, timeout=config.get_ovn_ovsdb_timeout()) return impl_idl_ovn.OvsdbSbOvnIdl(conn)