|
|
|
@ -290,9 +290,9 @@ import sqlalchemy.orm
|
|
|
|
|
from sqlalchemy.pool import NullPool, StaticPool
|
|
|
|
|
from sqlalchemy.sql.expression import literal_column
|
|
|
|
|
|
|
|
|
|
from neutron.openstack.common.db import exception
|
|
|
|
|
from neutron.openstack.common.gettextutils import _LE, _LW
|
|
|
|
|
from neutron.openstack.common import timeutils
|
|
|
|
|
from tacker.openstack.common.db import exception
|
|
|
|
|
from tacker.openstack.common.gettextutils import _LE, _LW
|
|
|
|
|
from tacker.openstack.common import timeutils
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
@ -743,8 +743,8 @@ def _patch_mysqldb_with_stacktrace_comments():
|
|
|
|
|
# db/api is just a wrapper around db/sqlalchemy/api
|
|
|
|
|
if filename.endswith('db/api.py'):
|
|
|
|
|
continue
|
|
|
|
|
# only trace inside neutron
|
|
|
|
|
index = filename.rfind('neutron')
|
|
|
|
|
# only trace inside tacker
|
|
|
|
|
index = filename.rfind('tacker')
|
|
|
|
|
if index == -1:
|
|
|
|
|
continue
|
|
|
|
|
stack += "File:%s:%s Method:%s() Line:%s | " \
|
|
|
|
@ -762,12 +762,12 @@ def _patch_mysqldb_with_stacktrace_comments():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class EngineFacade(object):
|
|
|
|
|
"""A helper class for removing of global engine instances from neutron.db.
|
|
|
|
|
"""A helper class for removing of global engine instances from tacker.db.
|
|
|
|
|
|
|
|
|
|
As a library, neutron.db can't decide where to store/when to create engine
|
|
|
|
|
As a library, tacker.db can't decide where to store/when to create engine
|
|
|
|
|
and sessionmaker instances, so this must be left for a target application.
|
|
|
|
|
|
|
|
|
|
On the other hand, in order to simplify the adoption of neutron.db changes,
|
|
|
|
|
On the other hand, in order to simplify the adoption of tacker.db changes,
|
|
|
|
|
we'll provide a helper class, which creates engine and sessionmaker
|
|
|
|
|
on its instantiation and provides get_engine()/get_session() methods
|
|
|
|
|
that are compatible with corresponding utility functions that currently
|
|
|
|
@ -775,7 +775,7 @@ class EngineFacade(object):
|
|
|
|
|
|
|
|
|
|
engine/sessionmaker instances will still be global (and they are meant to
|
|
|
|
|
be global), but they will be stored in the app context, rather that in the
|
|
|
|
|
neutron.db context.
|
|
|
|
|
tacker.db context.
|
|
|
|
|
|
|
|
|
|
Note: using of this helper is completely optional and you are encouraged to
|
|
|
|
|
integrate engine/sessionmaker instances into your apps any way you like
|