db: Remove 'cinder.database.migration_backend' entrypoint
We don't provide multiple backends in-tree and couldn't possibly support those provided out-of-tree. Remove this knob. Change-Id: Ia05eb6536bd4b2977358c0086293757091aa5e68 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
ea7ae8e655
commit
59c5f1e7ad
@ -17,22 +17,16 @@
|
||||
"""Database setup and migration commands."""
|
||||
|
||||
import os
|
||||
import threading
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_db import options
|
||||
from stevedore import driver
|
||||
from oslo_db.sqlalchemy import migration
|
||||
|
||||
from cinder.db.sqlalchemy import api as db_api
|
||||
|
||||
|
||||
INIT_VERSION = 122
|
||||
|
||||
_IMPL = None
|
||||
_LOCK = threading.Lock()
|
||||
|
||||
options.set_defaults(cfg.CONF)
|
||||
|
||||
INIT_VERSION = 122
|
||||
MIGRATE_REPO_PATH = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
'sqlalchemy',
|
||||
@ -40,23 +34,14 @@ MIGRATE_REPO_PATH = os.path.join(
|
||||
)
|
||||
|
||||
|
||||
def get_backend():
|
||||
global _IMPL
|
||||
if _IMPL is None:
|
||||
with _LOCK:
|
||||
if _IMPL is None:
|
||||
_IMPL = driver.DriverManager(
|
||||
"cinder.database.migration_backend",
|
||||
cfg.CONF.database.backend).driver
|
||||
return _IMPL
|
||||
|
||||
|
||||
def db_sync(version=None, init_version=INIT_VERSION, engine=None):
|
||||
def db_sync(version=None, engine=None):
|
||||
"""Migrate the database to `version` or the most recent version."""
|
||||
|
||||
if engine is None:
|
||||
engine = db_api.get_engine()
|
||||
return get_backend().db_sync(engine=engine,
|
||||
abs_path=MIGRATE_REPO_PATH,
|
||||
version=version,
|
||||
init_version=init_version)
|
||||
|
||||
return migration.db_sync(
|
||||
engine=engine,
|
||||
abs_path=MIGRATE_REPO_PATH,
|
||||
version=version,
|
||||
init_version=INIT_VERSION)
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Support for the ``cinder.database.migration_backend`` entrypoint, which
|
||||
provided for configurable database migration backends, has been removed.
|
||||
This was never exercised and was a source of unnecessary complexity.
|
Loading…
Reference in New Issue
Block a user