Merge "Remove Train online data migrations"
This commit is contained in:
commit
977ff8105c
@ -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
|
||||
|
||||
###################
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user