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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
####################
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
###################
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user