Cinder DB Cleanup Job fails

Summary

The cinder-manage db purge fails in the Yaook cinder-db-cleanup cronjob due to a missing --max_rows argument.

Detailed Description

The scheduled cleanup job for Cinder databases consistently fails due to a TypeError. This appears to be caused by a change in the cinder-manage db purge implementation introduced in a recent version of the Yaook Cinder container image.

Steps to reproduce the issue

  1. Deploy Cinder with the image version 2024.1:2.0.112 or higher
  2. Let the cinder-db-cleanup cronjob run as scheduled, or manually create a job from that cronjob
  3. Observe the job failing.

Result

The job fails with the following log output:

{"message": "Unhandled error", "asctime": "2025-07-09 00:00:14", "name": "cinder", "msg": "Unhandled error", "args": [], "levelname": "CRITICAL", "levelno": 50, "pathname": "/usr/local/lib/python3.8/site-packages/oslo_log/log.py", "filename": "log.py", "module": "log", "lineno": 203, "funcname": "logging_excepthook", "created": 1752019214.5368965, "msecs": 536.8964672088623, "relative_created": 1596.0545539855957, "thread": 137094789125952, "thread_name": "MainThread", "process_name": "MainProcess", "process": 1, "traceback": ["Traceback (most recent call last):", "  File \"/usr/local/bin/cinder-manage\", line 8, in <module>", "    sys.exit(main())", "  File \"/usr/local/lib/python3.8/site-packages/cinder/cmd/manage.py\", line 1171, in main", "    fn(**fn_kwargs)", "  File \"/usr/local/lib/python3.8/site-packages/cinder/cmd/manage.py\", line 227, in purge", "    max_rows = int(max_rows)", "TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'"], "hostname": "cinder-db-cleanup-lt5dc-29200320-5ntz2", "error_summary": "TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'", "context": {}, "extra": {"project": "unknown", "version": "unknown"}}

This indicates that the max_rows argument is expected but not provided, and positional argument parsing no longer sets it implicitly.

Expected Result

The cinder-manage db purge 60 command should successfully purge entries older than 60 days.

Additional Information

  • Affected image version from: registry.yaook.cloud/yaook/cinder-2024.1:2.0.112
  • Working image version: registry.yaook.cloud/yaook/cinder-2024.1:2.0.111
  • After adding the --max_rows flag to the cronjob command, the cinder-db-cleanup job succeded.

I suspect that this MR broke it.

Resolution

Proposal

To be discussed.

Specification

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this issue are to be interpreted in the spirit of RFC 2119, even though we're not technically doing protocol design.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information