While we added new_facade object attribute to framework and it has its
niche and used in some stadium subprojects, it's not ideal because it's
global to an object. Meaning that if you mark an object for new_facade =
True, *all* business logic using the object must also switch to new
facade in the same step, which is a pain and sometimes close to
impossible to do without changing thousands loosely related lines of
code in multiple modules. It would be nice to instead use objects as
usual in different contexts - some using engine facade and some still
using session.begin(...) - and allow the OVO framework to pick the right
way to nest subtransactions.
This patch does exactly that. We call an internal function from oslo.db
and check whether it raises an exception. If it does, it means that the
engine facade is not used; otherwise, we use the new style of nested
transactions management.
By default, if session is not active when OVO action is called, we stick
to the old facade. Once we are done with switching the rest of the
plugin code / OVO objects to the new facade, we will rip off the
transitionary logic.
Change-Id: Ia05df925eccf3c9d397748f282e995203a058de9
Partially-Implements: blueprint enginefacade-switch
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db