From b57d52aeb951bcfb9a2966ba7dc1b3f8b640bd8f Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Fri, 11 Jul 2014 14:34:26 +0200 Subject: [PATCH] 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 --- neutron/db/migration/alembic_migrations/env.py | 8 +++----- neutron/db/migration/migrate_to_ml2.py | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/neutron/db/migration/alembic_migrations/env.py b/neutron/db/migration/alembic_migrations/env.py index db20ce912f4..98c2678ea16 100644 --- a/neutron/db/migration/alembic_migrations/env.py +++ b/neutron/db/migration/alembic_migrations/env.py @@ -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( diff --git a/neutron/db/migration/migrate_to_ml2.py b/neutron/db/migration/migrate_to_ml2.py index 504061ed7cc..e42c9206c96 100755 --- a/neutron/db/migration/migrate_to_ml2.py +++ b/neutron/db/migration/migrate_to_ml2.py @@ -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)