Use oslo.db create_engine instead of SQLAlchemy
oslo.db may set additional options to engines that we may be interested in. blueprint enable-mysql-connector Closes-Bug: #1350942 Change-Id: I6f67bb430c50ddacb2d53398de75fb5f494964a0
This commit is contained in:
parent
33a5518bee
commit
5626fc258c
@ -18,8 +18,9 @@ from logging import config as logging_config
|
||||
|
||||
from alembic import context
|
||||
from oslo.config import cfg
|
||||
from oslo.db.sqlalchemy import session
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import create_engine, event, pool
|
||||
from sqlalchemy import event
|
||||
|
||||
from neutron.db import model_base
|
||||
from neutron.openstack.common import importutils
|
||||
@ -96,10 +97,7 @@ def run_migrations_online():
|
||||
|
||||
"""
|
||||
set_mysql_engine()
|
||||
|
||||
engine = create_engine(
|
||||
neutron_config.database.connection,
|
||||
poolclass=pool.NullPool)
|
||||
engine = session.create_engine(neutron_config.database.connection)
|
||||
|
||||
connection = engine.connect()
|
||||
context.configure(
|
||||
|
@ -60,6 +60,7 @@ To manually test migration from ovs to ml2 with devstack:
|
||||
|
||||
import argparse
|
||||
|
||||
from oslo.db.sqlalchemy import session
|
||||
import sqlalchemy as sa
|
||||
|
||||
from neutron.extensions import portbindings
|
||||
@ -126,7 +127,7 @@ class BaseMigrateToMl2_Icehouse(object):
|
||||
|
||||
def __call__(self, connection_url, save_tables=False, tunnel_type=None,
|
||||
vxlan_udp_port=None):
|
||||
engine = sa.create_engine(connection_url)
|
||||
engine = session.create_engine(connection_url)
|
||||
metadata = sa.MetaData()
|
||||
check_db_schema_version(engine, metadata)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user