cinder-manage quota sync crashes

Bug #2047693 reported by Dr. Jens Harbott
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
In Progress
Undecided
Unassigned

Bug Description

First seen in 2023.1, but also easily reproduced in devstack with current master:

debian@vm4:~/devstack$ /opt/stack/data/venv/bin/cinder-manage quota sync
INFO dbcounter [None req-35704751-5f08-40b5-aeef-6f62aa340a0c None None] Registered counter for database cinder
DEBUG oslo_db.sqlalchemy.engines [None req-35704751-5f08-40b5-aeef-6f62aa340a0c None None] MySQL server mode set to STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION {{(pid=133773) _check_effective_sql_mode /opt/stack/data/venv/lib/python3.11/site-packages/oslo_db/sqlalchemy/engines.py:342}}
DEBUG dbcounter [-] [133773] Writer thread running {{(pid=133773) stat_writer /opt/stack/data/venv/lib/python3.11/site-packages/dbcounter.py:102}}
CRITICAL cinder [None req-35704751-5f08-40b5-aeef-6f62aa340a0c None None] Unhandled error: sqlalchemy.exc.ArgumentError: Textual column expression 'project_id' should be explicitly declared with text('project_id'), or use column('project_id') for more specificity
ERROR cinder Traceback (most recent call last):
ERROR cinder File "/opt/stack/data/venv/bin/cinder-manage", line 10, in <module>
ERROR cinder sys.exit(main())
ERROR cinder ^^^^^^
ERROR cinder File "/opt/stack/cinder/cinder/cmd/manage.py", line 1151, in main
ERROR cinder fn(**fn_kwargs)
ERROR cinder File "/opt/stack/cinder/cinder/cmd/manage.py", line 385, in sync
ERROR cinder self._check_sync(project_id, do_fix=True)
ERROR cinder File "/opt/stack/cinder/cinder/cmd/manage.py", line 506, in _check_sync
ERROR cinder projects = self._get_quota_projects(ctxt, project_id)
ERROR cinder ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 1001, in wrapper
ERROR cinder return fn(*args, **kwargs)
ERROR cinder ^^^^^^^^^^^^^^^^^^^
ERROR cinder File "/opt/stack/cinder/cinder/cmd/manage.py", line 415, in _get_quota_projects
ERROR cinder ).with_entities('project_id').distinct().all()
ERROR cinder ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR cinder File "<string>", line 2, in with_entities
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/sqlalchemy/sql/base.py", line 110, in _generative
ERROR cinder x = fn(self, *args, **kw)
ERROR cinder ^^^^^^^^^^^^^^^^^^^^^
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 1452, in with_entities
ERROR cinder self._set_entities(entities)
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 187, in _set_entities
ERROR cinder self._raw_columns = [
ERROR cinder ^
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/sqlalchemy/orm/query.py", line 188, in <listcomp>
ERROR cinder coercions.expect(
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 188, in expect
ERROR cinder resolved = impl._literal_coercion(
ERROR cinder ^^^^^^^^^^^^^^^^^^^^^^^
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 388, in _literal_coercion
ERROR cinder return self._text_coercion(element, argname, **kw)
ERROR cinder ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/sqlalchemy/sql/coercions.py", line 841, in _text_coercion
ERROR cinder raise exc.ArgumentError(
ERROR cinder sqlalchemy.exc.ArgumentError: Textual column expression 'project_id' should be explicitly declared with text('project_id'), or use column('project_id') for more specificity
ERROR cinder

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :
Download full text (6.0 KiB)

There is a different error when running quota sync for a specific project, note that this need an actual volume to exist for that project in order to trigger the error. Not sure yet if this is related or not.

$ /opt/stack/data/venv/bin/cinder-manage quota sync --project b0bd58002f3141cd90d7066e74cc5c1b
INFO dbcounter [None req-f6f3e9f8-106a-48c0-b377-d1248b03e31f None None] Registered counter for database cinder
DEBUG oslo_db.sqlalchemy.engines [None req-f6f3e9f8-106a-48c0-b377-d1248b03e31f None None] MySQL server mode set to STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FO
R_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION {{(pid=412126) _check_effective_sql_mode /opt/stack/data/venv/lib/python3.11/site-packages/oslo_db/sqlalchemy/engines
.py:342}}
DEBUG dbcounter [-] [412126] Writer thread running {{(pid=412126) stat_writer /opt/stack/data/venv/lib/python3.11/site-packages/dbcounter.py:102}}
Processing quota usage for project b0bd58002f3141cd90d7066e74cc5c1b
CRITICAL cinder [None req-f6f3e9f8-106a-48c0-b377-d1248b03e31f None None] Unhandled error: AttributeError: module 'cinder.context' has no attribute 'session' ERROR cinder Traceback (most recent call last): ERROR cinder File "/opt/stack/data/venv/bin/cinder-manage", line 8, in <module>
ERROR cinder sys.exit(main())
ERROR cinder ^^^^^^
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/cinder/cmd/manage.py", line 1151, in main
ERROR cinder fn(**fn_kwargs)
ERROR cinder File "/opt/stack/data/venv/lib/python3.11/site-packages/cinder/cmd/manage.py", line 385, in sync
ERROR cinder self._check_sync(project_id, do_fix=True) ...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to cinder (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/904451

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/904453

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/904456

Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to cinder (master)

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/904487

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Related fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/cinder/+/910234

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to cinder (master)

Reviewed: https://review.opendev.org/c/openstack/cinder/+/904451
Committed: https://opendev.org/openstack/cinder/commit/4e511e5b4b6ad44bf35600ae70e1646496d66602
Submitter: "Zuul (22348)"
Branch: master

commit 4e511e5b4b6ad44bf35600ae70e1646496d66602
Author: Dr. Jens Harbott <email address hidden>
Date: Fri Dec 29 17:13:25 2023 +0100

    Fix error in cinder-manage quota sync cmd

    This fixes a regression introduced in [0] which changed a variable name
    in some function definitions, but failed to change the matching variable
    references.

    Change some similar functions for consistency and to avoid overloading
    imports with local variable names.

    [0] https://review.opendev.org/c/openstack/cinder/+/842542

    Related-Bug: 2047693
    Change-Id: I153a73ad88762d5baa3f3c2c5c752e56280f7dc0

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.