Repository navigation
Closed
Description
I run the test against a cloud that's missing cinder-backup. The test creates a backup resource, which is in permanent error state because of the missing service, and I cannot delete it. This might be called a cinder bug, but the test triggered it. We cannot use a test that leaks resources.
What's more: the test doesn't delete the volume either because of the uncaught timeout exception...
My shell journey (abridged):
$ Tests/iaas/volume-backup/volume-backup-tester.py --os-cloud poc-wgcloud --debug
Performing cleanup for resources with the 'scs-test-' prefix ...
Creating volume ...
↳ waiting for volume with ID 'ffc4136f-df3f-4d00-8ad7-78a0dd2c04ad' to reach status 'available' ...
Create empty volume: PASS
Creating backup from volume ...
Traceback (most recent call last):
File "/home/matthiasbuechse/opensrc/scs/standards/Tests/iaas/volume-backup/volume-backup-tester.py", line 283, in <module>
main()
File "/home/matthiasbuechse/opensrc/scs/standards/Tests/iaas/volume-backup/volume-backup-tester.py", line 278, in main
test_backup(conn, prefix=args.prefix, timeout=args.timeout)
File "/home/matthiasbuechse/opensrc/scs/standards/Tests/iaas/volume-backup/volume-backup-tester.py", line 115, in test_backup
assert seconds_waited < timeout, (
^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Timeout reached while waiting for backup to reach status 'available' (backup id: 86cc7f49-e91d-47b6-9668-959759820136) after 60 seconds
$ OS_CLOUD=poc-wgcloud .cargo/bin/osc block-storage backup show 86cc7f49-e91d-47b6-9668-959759820136
┌───────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Attribute ┆ Value │
╞═══════════════════════╪════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
│ created_at ┆ 2024-10-30T19:55:23.000000 │
│ data_timestamp ┆ 2024-10-30T19:55:23.000000 │
│ fail_reason ┆ Service not found for creating backup. │
│ has_dependent_backups ┆ false │
│ id ┆ 86cc7f49-e91d-47b6-9668-959759820136 │
│ is_incremental ┆ false │
│ links ┆ [{"href":"https://block-storage.l1a.cloudandheat.com/v3/8ef56c4ec0a046f98ec3d95c7a677a6e/backups/86cc7f49-e91d-47b6-9668-959759820136","rel":"self"},{"href":"https://block-storage.l1a.cloudandheat.com/8ef56c4ec0a046f98ec3d95c7a677a6e/backups/86cc7f49-e91d-47b6-9668-959759820136","rel":"bookmark"}] │
│ metadata ┆ {} │
│ name ┆ scs-test-volume-backup │
│ object_count ┆ 0 │
│ size ┆ 1 │
│ status ┆ error │
│ updated_at ┆ 2024-10-30T19:55:23.000000 │
│ volume_id ┆ ffc4136f-df3f-4d00-8ad7-78a0dd2c04ad │
└───────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
$ OS_CLOUD=poc-wgcloud .cargo/bin/osc block-storage backup force-delete 86cc7f49-e91d-47b6-9668-959759820136
Error:
0: openstack server error:
uri: `https://block-storage.l1a.cloudandheat.com/v3/8ef56c4ec0a046f98ec3d95c7a677a6e/backups/86cc7f49-e91d-47b6-9668-959759820136/action?`
status: `403 Forbidden`
data: `{"forbidden":{"code":403,"message":"Policy doesn't allow volume_extension:backup_admin_actions:force_delete to be performed."}}`
Location:
openstack_cli/src/bin/osc.rs:31Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
mbuechse commentedon Oct 30, 2024
definition of done
available(such aserror)assertif the exception essential for the program flow (asserts will be stripped withpython3 -O, and then the loop will become an endless loop)[-][BUG] volume-backup-tester.py leaking backup resource[/-][+][BUG] volume-backup-tester.py leaking backup and volume resources[/+]markus-hentsch commentedon Nov 4, 2024
Turns out that Cinder is terrible at handling changes to the backup service at runtime, especially when using
volume service set [--disable/--enable]while the other Cinder services keep running.Cinder exhibits different behavior depending on the presence of the backup service, its service registration entry as well as the current state of other Cinder services.
Furthermore, Cinder always defaults to the Swift object storage backup driver if no configuration option for the backup service is set and will automatically discover the Swift endpoint from the service catalog if it is not specified in the configuration.
The only determining factor is the volume service entry in Cinder's database as well as the presence of an actual cinder-backup process.
This can lead to the backup service to be either present or absent in non-obvious manners.
Permutations of Cinder behavior with regard to the backup service (click to expand ...)
A) backup service disabled but running
State:
openstack volume service set --disable devstack cinder-backupsystemctl start devstack@c-bakResult:
openstack volume service listavailablestateNote: the backup can be deleted once
openstack volume service set --enable devstack cinder-backupis used.B) backup service disabled and stopped
State:
openstack volume service set --disable devstack cinder-backupsystemctl stop devstack@c-bakResult:
openstack volume service listcreatingstate foreverbacking-upstate foreverC) backup service disabled and stopped + other services restarted
This case effectively represents the backup service not being configured in the first place and hence reproduces the original bug report.
State:
openstack volume service set --disable devstack cinder-backupsystemctl stop devstack@c-baksystemctl restart devstack@c-api devstack@c-vol devstack@c-schResult:
openstack volume service listerrorstateD) backup service enabled but stopped
State:
openstack volume service set --enable devstack cinder-backupsystemctl stop devstack@c-baksystemctl restart devstack@c-api devstack@c-vol devstack@c-schResult:
openstack volume service listerrorstateCase A is especially bizarre as it allows some actions against a disabled service that do have implications.
Case C seems to be the closest to what was reported above and should resemble setups where the volume backup service was never deployed.
The most reliable precaution would be to check
volume service list(i.e. the corresponding API) for the presence of any backup service and if it is both "enabled" and "up".Sadly, this API (
volume_extension:services:index) is per default admin-only and can't be queried as a regular user.It is pretty bad that Cinder allows creation of a volume backup resource regardless of the backup service's presence and state but on the other hand does not allow deletion of such resource if anything is wrong with the service or if it is absent.
mbuechse commentedon Nov 4, 2024
@markus-hentsch Impressive research work! So there's nothing we can do really? :(
berendt commentedon Nov 4, 2024
@mbuechse Can you try if a volume backup list fails when backups are not possible? That might be a workaround if you try that first. If this does not work then no backups are usable.
markus-hentsch commentedon Nov 4, 2024
Everything in
openstack volume backup [create|list|show]succeeds* even if the backup service is disabled and down. These things happen mostly at database/API level and seem only asynchronously consumed by the backup service. Onlyopenstack volume backup deletefails as it actually tries to talk to the backup service in a synchronous manner.*
volume backup createsucceeds so far as creating a backup resource that is visible viavolume backup list, it will be in "error" state however if the backup service is absent.That seems to me like a pretty severe architectural design flaw in Cinder from a user's perspective as the presence of the backup service cannot be checked until creation/deletion attempts.
markus-hentsch commentedon Nov 4, 2024
I can address the other valid points you raised about the testing script.
However, in regard to the undeletable leftover backup resource I currently have no idea how to tackle. Any attempts to figure out the presence of the backup service as a non-admin user have failed due to it being obfuscated by the API layer (see comment above).
I'm currently trying to get in touch with the Cinder community1 but so far I'm out of ideas.
Footnotes
https://meetings.opendev.org/irclogs/%23openstack-cinder/%23openstack-cinder.2024-11-04.log.html#t2024-11-04T14:08:48 ↩
markus-hentsch commentedon Nov 4, 2024
FTR, the backup service is not mandatory. The official documentation even states:
As such, I think this is an actual flaw/bug in Cinder in general.
mbuechse commentedon Nov 4, 2024
I think we will live with that, because the service is mandatory for SCS-compatible IaaS v5 and any leak only due to a failure to comply
markus-hentsch commentedon Nov 4, 2024
Except for the first point, I addressed all points in #802
markus-hentsch commentedon Nov 5, 2024
FTR, I created an upstream bug report based on my findings: https://bugs.launchpad.net/cinder/+bug/2086683