Merge "Fix "cinder-manage quota check"" into stable/2024.1

This commit is contained in:
Zuul 2025-01-10 21:25:42 +00:00 committed by Gerrit Code Review
commit eeb592af5e
4 changed files with 18 additions and 5 deletions

View File

@ -403,11 +403,9 @@ class QuotaCommands(object):
return []
return [project_id]
projects = db_api.model_query(
ctxt,
models.QuotaUsage,
read_deleted="no"
).with_entities('project_id').distinct().all()
projects = db_api.get_projects(ctxt,
models.QuotaUsage,
read_deleted="no")
project_ids = [row.project_id for row in projects]
return project_ids

View File

@ -1987,3 +1987,7 @@ def attachment_specs_update_or_create(context,
def remove_temporary_admin_metadata_data_migration(context, max_count):
return IMPL.remove_temporary_admin_metadata_data_migration(
context, max_count)
def get_projects(context, model, read_deleted="no"):
return IMPL.get_projects(context, model, read_deleted=read_deleted)

View File

@ -8679,3 +8679,8 @@ CALCULATE_COUNT_HELPERS = {
'snapshot': (_snaps_get_query, _process_snaps_filters),
'backup': (_backups_get_query, _process_backups_filters),
}
def get_projects(context, model, read_deleted="no"):
return model_query(context, model, read_deleted=read_deleted).\
with_entities(sa.Column('project_id')).distinct().all()

View File

@ -0,0 +1,6 @@
---
fixes:
- |
`Bug #2077643 <https://bugs.launchpad.net/cinder/+bug/2077643>`_: Fixed
"cinder-manage quota sync" CLI command, which failed with an sqlalchemy
error when a project id was not specified.