**** CubicPower OpenStack Study ****
def _create_facade_lazily():
global _FACADE
if _FACADE is None:
_FACADE = db_session.EngineFacade(CONF.baremetal.sql_connection,
**dict(CONF.database.iteritems()))
return _FACADE
**** CubicPower OpenStack Study ****
def get_session(autocommit=True, expire_on_commit=False):
"""Return a SQLAlchemy session."""
facade = _create_facade_lazily()
return facade.get_session(autocommit=autocommit,
expire_on_commit=expire_on_commit)
**** CubicPower OpenStack Study ****
def get_engine():
"""Return a SQLAlchemy engine."""
facade = _create_facade_lazily()
return facade.get_engine()