Add a deprecation warning to the DB downgrade

DB downgrade doesn't be supported in OpenStack now. Glance will
remove it in N release. In M cycle, we should add a warning to users.

Closes-bug: #1501233
Implements: blueprint remove-db-downgrade
Change-Id: I2791d8421abc0ad6c4905d5ddaa3fa99f264e333
This commit is contained in:
wangxiyuan 2015-10-30 14:54:48 +08:00
parent a879755135
commit e3366afdfb
1 changed files with 8 additions and 0 deletions

View File

@ -87,6 +87,10 @@ class DbCommands(object):
@args('--version', metavar='<version>', help='Database version')
def downgrade(self, version=None):
"""Downgrade the database's migration level"""
print("Warning: DB downgrade is deprecated and will be removed in N "
"release. Users should make a full database backup of the "
"production data before attempting any upgrade.",
file=sys.stderr)
migration.db_sync(db_api.get_engine(),
db_migration.MIGRATE_REPO_PATH,
version)
@ -160,6 +164,10 @@ class DbLegacyCommands(object):
self.command_object.upgrade(CONF.command.version)
def downgrade(self, version=None):
print("Warning: DB downgrade is deprecated and will be removed in N "
"release. Users should make a full database backup of the "
"production data before attempting any upgrade.",
file=sys.stderr)
self.command_object.downgrade(CONF.command.version)
def version_control(self, version=None):