Maybe implemented the zope transactions
This commit is contained in:
@@ -19,7 +19,7 @@ v2 Quantum Plug-in API Quark Implementation
|
|||||||
|
|
||||||
import netaddr
|
import netaddr
|
||||||
from sqlalchemy import func as sql_func
|
from sqlalchemy import func as sql_func
|
||||||
from sqlalchemy.orm import sessionmaker
|
from sqlalchemy.orm import sessionmaker, scoped_session
|
||||||
from zope.sqlalchemy import ZopeTransactionExtension
|
from zope.sqlalchemy import ZopeTransactionExtension
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
@@ -61,9 +61,10 @@ class Plugin(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
"ip_addresses"]
|
"ip_addresses"]
|
||||||
|
|
||||||
def _initDBMaker(self):
|
def _initDBMaker(self):
|
||||||
db_api._MAKER = sessionmaker(bind=db_api._ENGINE,
|
# This needs to be called after _ENGINE is configured or it doesn't work
|
||||||
autocommit=True,
|
db_api._MAKER = scoped_session(sessionmaker(bind=db_api._ENGINE,
|
||||||
expire_on_commit=False)
|
twophase=True,
|
||||||
|
extension=ZopeTransactionExtension()))
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
db_api.configure_db()
|
db_api.configure_db()
|
||||||
|
|||||||
Reference in New Issue
Block a user