From 7268ec61005d89f2ee75408daea47e14421a03a0 Mon Sep 17 00:00:00 2001 From: Brian Rosmaita Date: Wed, 26 Aug 2020 16:18:46 -0400 Subject: [PATCH] Remove Train online data migrations Online data migrations are supposed to be removed in the following development cycle, so these migrations from Train are overdue. This change should NOT be backported to Ussuri, however, as there was a bug in the Train migrations and a fixed version of the migrations may still need to be run in Ussuri. See Bug #1893107 for more info. Change-Id: I78681ea89762790f544178725999903a41d75ad1 Closes-bug: #1893114 --- cinder/cmd/manage.py | 7 +----- cinder/db/api.py | 7 ------ cinder/db/sqlalchemy/api.py | 49 ------------------------------------- 3 files changed, 1 insertion(+), 62 deletions(-) diff --git a/cinder/cmd/manage.py b/cinder/cmd/manage.py index 45fc102f4b8..b9f84641de9 100644 --- a/cinder/cmd/manage.py +++ b/cinder/cmd/manage.py @@ -248,12 +248,7 @@ class DbCommands(object): # preceed any element of the "online_migrations" tuple, like this: # # Added in Queens remove in Rocky # db.service_uuids_online_data_migration, - online_migrations = ( - # Added in Train - db.untyped_volumes_online_data_migration, - # Added in Train - db.untyped_snapshots_online_data_migration - ) + online_migrations = tuple() def __init__(self): pass diff --git a/cinder/db/api.py b/cinder/db/api.py index b101c27c969..b53b5713403 100644 --- a/cinder/db/api.py +++ b/cinder/db/api.py @@ -429,13 +429,6 @@ def volume_has_other_project_snp_filter(): return IMPL.volume_has_other_project_snp_filter() -def untyped_volumes_online_data_migration(context, max_count): - return IMPL.untyped_volumes_online_data_migration(context, max_count) - - -def untyped_snapshots_online_data_migration(context, max_count): - return IMPL.untyped_snapshots_online_data_migration(context, max_count) - #################### diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py index 2d6c6978fad..e0d86096dba 100644 --- a/cinder/db/sqlalchemy/api.py +++ b/cinder/db/sqlalchemy/api.py @@ -584,55 +584,6 @@ def service_update(context, service_id, values): raise exception.ServiceNotFound(service_id=service_id) -@enginefacade.writer -def untyped_volumes_online_data_migration(context, max_count): - from cinder.volume import volume_types - default_type = volume_types.get_volume_type_by_name(context, - '__DEFAULT__') - # get all volumes having volume_type=None - total = 0 - updated = 0 - session = get_session() - with session.begin(): - total = model_query(context, - models.Volume, - session=session).filter_by( - volume_type_id=None).limit(max_count).count() - volumes = model_query(context, - models.Volume, - session=session).filter_by( - volume_type_id=None).limit(max_count).all() - for volume in volumes: - volume.volume_type_id = default_type.get('id') - updated += 1 - - return total, updated - - -@enginefacade.writer -def untyped_snapshots_online_data_migration(context, max_count): - from cinder.volume import volume_types - default_type = volume_types.get_volume_type_by_name(context, - '__DEFAULT__') - # get all snapshots having volume_type=None - total = 0 - updated = 0 - session = get_session() - with session.begin(): - total = model_query(context, - models.Snapshot, - session=session).filter_by( - volume_type_id=None).limit(max_count).count() - snapshots = model_query(context, - models.Snapshot, - session=session).filter_by( - volume_type_id=None).limit(max_count).all() - for snapshot in snapshots: - snapshot.volume_type_id = default_type.get('id') - updated += 1 - - return total, updated - ###################