Ensure DB pooling code works with newer eventlet versions

Bug 1097992

Change-Id: Id14697a0a4815d0aacbae769bf538a96d6846567
This commit is contained in:
Salvatore Orlando 2013-03-14 01:05:45 +01:00 committed by Dan Wendlandt
parent 5840f24ef3
commit 428290399a
1 changed files with 10 additions and 2 deletions

View File

@ -137,8 +137,16 @@ def configure_db():
'max_size': cfg.CONF.DATABASE.sql_max_pool_size,
'max_idle': cfg.CONF.DATABASE.sql_idle_timeout
}
creator = db_pool.ConnectionPool(MySQLdb, **pool_args)
engine_args['creator'] = creator.create
pool = db_pool.ConnectionPool(MySQLdb, **pool_args)
def creator():
conn = pool.create()
# NOTE(belliott) eventlet >= 0.10 returns a tuple
if isinstance(conn, tuple):
_1, _2, conn = conn
return conn
engine_args['creator'] = creator
if (MySQLdb is None and cfg.CONF.DATABASE.sql_dbpool_enable):
LOG.warn(_("Eventlet connection pooling will not work without "
"python-mysqldb!"))