diff --git a/ceilometer/alarm/storage/impl_sqlalchemy.py b/ceilometer/alarm/storage/impl_sqlalchemy.py index e0cc6c9ce..059b41d5f 100644 --- a/ceilometer/alarm/storage/impl_sqlalchemy.py +++ b/ceilometer/alarm/storage/impl_sqlalchemy.py @@ -20,7 +20,6 @@ from __future__ import absolute_import import os from oslo.config import cfg -from oslo.db.sqlalchemy import migration from oslo.db.sqlalchemy import session as db_session from sqlalchemy import desc @@ -87,6 +86,8 @@ class Connection(base.Connection): ) def upgrade(self): + # NOTE(gordc): to minimise memory, only import migration when needed + from oslo.db.sqlalchemy import migration path = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', '..', 'storage', 'sqlalchemy', 'migrate_repo') diff --git a/ceilometer/storage/impl_sqlalchemy.py b/ceilometer/storage/impl_sqlalchemy.py index f4d7de023..d1f7671e1 100644 --- a/ceilometer/storage/impl_sqlalchemy.py +++ b/ceilometer/storage/impl_sqlalchemy.py @@ -24,7 +24,6 @@ import os from oslo.config import cfg from oslo.db import exception as dbexc -from oslo.db.sqlalchemy import migration from oslo.db.sqlalchemy import session as db_session from oslo.utils import timeutils import six @@ -227,6 +226,8 @@ class Connection(base.Connection): ) def upgrade(self): + # NOTE(gordc): to minimise memory, only import migration when needed + from oslo.db.sqlalchemy import migration path = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sqlalchemy', 'migrate_repo') migration.db_sync(self._engine_facade.get_engine(), path)