From 427feb7f927b2f56cf8e0daa871580091340cf83 Mon Sep 17 00:00:00 2001 From: Chris Dent Date: Tue, 2 Oct 2018 14:10:13 +0100 Subject: [PATCH] Remove placement.db.migration This is part of a series of patches to remove noise from the db migration in placement so that if/when we switch to alembic there isn't confusing stuff in the way. This change removes placement.db.migration which is a mapping to placemement.db.sqlalchemy.migration. Since we only use sqlalchemy we don't need the mapping. Change-Id: I9ad49ecf6fc9958d4181b3cbb749185eaacffb9d --- placement/db/migration.py | 56 ------------------------------------- placement/tests/fixtures.py | 2 +- 2 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 placement/db/migration.py diff --git a/placement/db/migration.py b/placement/db/migration.py deleted file mode 100644 index 62913a070..000000000 --- a/placement/db/migration.py +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -"""Database setup and migration commands.""" - -from placement.db.sqlalchemy import migration - -IMPL = migration - - -def db_sync(version=None, database='main', context=None): - """Migrate the database to `version` or the most recent version.""" - return IMPL.db_sync(version=version, database=database, context=context) - - -def db_version(database='main', context=None): - """Display the current database version.""" - return IMPL.db_version(database=database, context=context) - - -def db_initial_version(database='main'): - """The starting version for the database.""" - return IMPL.db_initial_version(database=database) - - -def db_null_instance_uuid_scan(delete=False): - """Utility for scanning the database to look for NULL instance uuid rows. - - Scans the backing nova database to look for table entries where - instances.uuid or instance_uuid columns are NULL (except for the - fixed_ips table since that can contain NULL instance_uuid entries by - design). Dumps the tables that have NULL instance_uuid entries or - optionally deletes them based on usage. - - This tool is meant to be used in conjunction with the 267 database - migration script to detect and optionally cleanup NULL instance_uuid - records. - - :param delete: If true, delete NULL instance_uuid records found, else - just query to see if they exist for reporting. - :returns: dict of table name to number of hits for NULL instance_uuid rows. - """ - return IMPL.db_null_instance_uuid_scan(delete=delete) diff --git a/placement/tests/fixtures.py b/placement/tests/fixtures.py index 7dfdc84ea..0365415d7 100644 --- a/placement/tests/fixtures.py +++ b/placement/tests/fixtures.py @@ -21,7 +21,7 @@ from __future__ import absolute_import import fixtures from oslo_config import cfg -from placement.db import migration +from placement.db.sqlalchemy import migration from placement import db_api as placement_db