Fix up inconsistent max_count argument in o-d-ms
About two thirds of our online data migrations are using 'count' as the name for the limit argument, where the others (and the runner) call it max_count. This makes them all consistent with the original intent. Change-Id: I33a4afdef0f19bf667af616b1ba2b032d166b546
This commit is contained in:
parent
25be0306d7
commit
bb06d8817f
@ -3475,12 +3475,12 @@ def migration_get_by_sort_filters(context, sort_keys, sort_dirs, values):
|
||||
|
||||
|
||||
@pick_context_manager_writer
|
||||
def migration_migrate_to_uuid(context, count):
|
||||
def migration_migrate_to_uuid(context, max_count):
|
||||
# Avoid circular import
|
||||
from nova import objects
|
||||
|
||||
db_migrations = model_query(context, models.Migration).filter_by(
|
||||
uuid=None).limit(count).all()
|
||||
uuid=None).limit(max_count).all()
|
||||
|
||||
done = 0
|
||||
for db_migration in db_migrations:
|
||||
|
@ -119,11 +119,11 @@ class BlockDeviceMapping(base.NovaPersistentObject, base.NovaObject,
|
||||
del primitive['tag']
|
||||
|
||||
@classmethod
|
||||
def populate_uuids(cls, context, count):
|
||||
def populate_uuids(cls, context, max_count):
|
||||
@db.pick_context_manager_reader
|
||||
def get_bdms_no_uuid(context):
|
||||
return context.session.query(db_models.BlockDeviceMapping).\
|
||||
filter_by(uuid=None).limit(count).all()
|
||||
filter_by(uuid=None).limit(max_count).all()
|
||||
|
||||
db_bdms = get_bdms_no_uuid(context)
|
||||
|
||||
|
@ -1331,12 +1331,12 @@ def _make_instance_list(context, inst_list, db_inst_list, expected_attrs):
|
||||
|
||||
|
||||
@db.pick_context_manager_writer
|
||||
def populate_missing_availability_zones(context, count):
|
||||
def populate_missing_availability_zones(context, max_count):
|
||||
# instances without host have no reasonable AZ to set
|
||||
not_empty_host = models.Instance.host != None # noqa E711
|
||||
instances = (context.session.query(models.Instance).
|
||||
filter(not_empty_host).
|
||||
filter_by(availability_zone=None).limit(count).all())
|
||||
filter_by(availability_zone=None).limit(max_count).all())
|
||||
count_all = len(instances)
|
||||
count_hit = 0
|
||||
for instance in instances:
|
||||
@ -1348,10 +1348,10 @@ def populate_missing_availability_zones(context, count):
|
||||
|
||||
|
||||
@db.pick_context_manager_writer
|
||||
def populate_instance_compute_id(context, count):
|
||||
def populate_instance_compute_id(context, max_count):
|
||||
instances = (context.session.query(models.Instance).
|
||||
filter(models.Instance.compute_id == None). # noqa E711
|
||||
limit(count).all())
|
||||
limit(max_count).all())
|
||||
count_all = count_hit = 0
|
||||
rd_context = nova_context.get_admin_context(read_deleted='yes')
|
||||
for instance in instances:
|
||||
|
@ -215,11 +215,11 @@ class PciDevice(base.NovaPersistentObject, base.NovaObject):
|
||||
return not (self == other)
|
||||
|
||||
@classmethod
|
||||
def populate_dev_uuids(cls, context, count):
|
||||
def populate_dev_uuids(cls, context, max_count):
|
||||
@db.pick_context_manager_reader
|
||||
def get_devs_no_uuid(context):
|
||||
return context.session.query(db_models.PciDevice).\
|
||||
filter_by(uuid=None).limit(count).all()
|
||||
filter_by(uuid=None).limit(max_count).all()
|
||||
|
||||
db_devs = get_devs_no_uuid(context)
|
||||
|
||||
|
@ -558,9 +558,9 @@ def _create_limits_in_api_db(context, db_limits, per_user=False):
|
||||
user_id=user_id)
|
||||
|
||||
|
||||
def migrate_quota_limits_to_api_db(context, count):
|
||||
def migrate_quota_limits_to_api_db(context, max_count):
|
||||
# Migrate per project limits
|
||||
main_per_project_limits = _get_main_per_project_limits(context, count)
|
||||
main_per_project_limits = _get_main_per_project_limits(context, max_count)
|
||||
done = 0
|
||||
try:
|
||||
# Create all the limits in a single transaction.
|
||||
@ -575,11 +575,11 @@ def migrate_quota_limits_to_api_db(context, count):
|
||||
_destroy_main_per_project_limits(context, db_limit.project_id,
|
||||
db_limit.resource)
|
||||
done += 1
|
||||
if done == count:
|
||||
if done == max_count:
|
||||
return len(main_per_project_limits), done
|
||||
# Migrate per user limits
|
||||
count -= done
|
||||
main_per_user_limits = _get_main_per_user_limits(context, count)
|
||||
max_count -= done
|
||||
main_per_user_limits = _get_main_per_user_limits(context, max_count)
|
||||
try:
|
||||
# Create all the limits in a single transaction.
|
||||
_create_limits_in_api_db(context, main_per_user_limits, per_user=True)
|
||||
@ -621,8 +621,8 @@ def _create_classes_in_api_db(context, db_classes):
|
||||
db_class.resource, db_class.hard_limit)
|
||||
|
||||
|
||||
def migrate_quota_classes_to_api_db(context, count):
|
||||
main_quota_classes = _get_main_quota_classes(context, count)
|
||||
def migrate_quota_classes_to_api_db(context, max_count):
|
||||
main_quota_classes = _get_main_quota_classes(context, max_count)
|
||||
done = 0
|
||||
try:
|
||||
# Create all the classes in a single transaction.
|
||||
|
Loading…
x
Reference in New Issue
Block a user