Skip to content

Improve robustness and reliability of the volume backup API conformance check script - #802

Merged
markus-hentsch merged 11 commits into
mainfrom
fix/cinder-backup-check-reliability
Nov 5, 2024
Merged

markus-hentsch merged 11 commits into
mainfrom
fix/cinder-backup-check-reliability

Conversation

@markus-hentsch

Copy link
Copy Markdown
Contributor

According to research in #795, Cinder will create volume backup resources even if the volume backup service is disabled/down/absent but such resources cannot be deleted by the normal user and will be stuck in error state. This made the script get stuck and not even reach the volume cleanup.

Currently it does not seem possible for a non-admin user to determine the presence and health of the volume backup service before attempting to create backups.
This PR aims to increase the reliability and robustness of the corresponding check script to handle misconfigured clouds a bit more gracefully:

  • attempt to cleanup resources in error state, not only available ones
  • don't use assert for error handling which would be omitted by python3 -O
  • try to continue cleanups even if timeouts happen to clean up as much as possible

Closes #795

@markus-hentsch

Copy link
Copy Markdown
Contributor Author

Test with healthy backup service:

python3 volume-backup-tester.py --os-cloud pve-devstack --timeout 45

Performing cleanup for resources with the 'scs-test-' prefix ...
Creating volume 'scs-test-volume' ...
↳ waiting for volume with ID '9be06552-e54f-4450-8acb-d0818df11267' to reach status 'available' ...
Create empty volume: PASS
Creating backup from volume ...
↳ waiting for backup 'd0dad9de-7910-4642-b8dd-bc4973248fc7' to become available ...
Create backup from volume: PASS
Restoring backup to volume 'scs-test-restored-backup' ...
↳ waiting for restoration target volume 'scs-test-restored-backup' to be created ...
↳ waiting for restoration target volume 'scs-test-restored-backup' to reach 'available' status ...
Restore volume from backup: PASS

Performing cleanup for resources with the 'scs-test-' prefix ...
↳ deleting volume backup 'd0dad9de-7910-4642-b8dd-bc4973248fc7' ...
↳ deleting volume 'f8e965d1-6068-42d6-a7f6-7ce1a58a7173' ...
↳ deleting volume '9be06552-e54f-4450-8acb-d0818df11267' ...

Test with absent backup service:

python3 volume-backup-tester.py --os-cloud pve-devstack --timeout 45

Performing cleanup for resources with the 'scs-test-' prefix ...
Creating volume 'scs-test-volume' ...
↳ waiting for volume with ID 'd322a0f1-5b54-4390-88b5-76daf737a7ab' to reach status 'available' ...
Create empty volume: PASS
Creating backup from volume ...
↳ waiting for backup 'db4c1d27-a551-4a9d-aa48-a5eef936a18e' to become available ...

Performing cleanup for resources with the 'scs-test-' prefix ...
WARNING: Timeout reached while waiting for backup during cleanup to be in status ['available', 'error'] (backup id: db4c1d27-a551-4a9d-aa48-a5eef936a18e) after 45 seconds
WARNING: Timeout reached while waiting for all backups with prefix 'scs-test-' to finish deletion during cleanup after 45 seconds
WARNING: Timeout reached while waiting for volume during cleanup to be in status ['available', 'error'] (volume id: d322a0f1-5b54-4390-88b5-76daf737a7ab) after 45 seconds
There may be leftover resources with the 'scs-test-' prefix that could not be cleaned up!
Traceback (most recent call last):
  File "/home/mahe/CnH-Git/SCS/standards/fix/cinder-backup-check-reliability/Tests/iaas/volume-backup/volume-backup-tester.py", line 337, in <module>
    main()
  File "/home/mahe/CnH-Git/SCS/standards/fix/cinder-backup-check-reliability/Tests/iaas/volume-backup/volume-backup-tester.py", line 327, in main
    test_backup(conn, prefix=args.prefix, timeout=args.timeout)
  File "/home/mahe/CnH-Git/SCS/standards/fix/cinder-backup-check-reliability/Tests/iaas/volume-backup/volume-backup-tester.py", line 135, in test_backup
    ensure(
  File "/home/mahe/CnH-Git/SCS/standards/fix/cinder-backup-check-reliability/Tests/iaas/volume-backup/volume-backup-tester.py", line 44, in ensure
    raise ConformanceTestException(error_message)
ConformanceTestException: Timeout reached while waiting for backup to reach status 'available' (backup id: db4c1d27-a551-4a9d-aa48-a5eef936a18e) after 45 seconds

@mbuechse mbuechse left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be effective. The only thing that I would do in addition: if at the beginning there are backups that can't be deleted, and the error message says that cinder-backup is missing, then the test should already be considered an overall fail.

@markus-hentsch

markus-hentsch commented Nov 5, 2024 •

Copy link
Copy Markdown
Contributor Author

This seems to be effective. The only thing that I would do in addition: if at the beginning there are backups that can't be deleted, and the error message says that cinder-backup is missing, then the test should already be considered an overall fail.

I made the backup deletion failure due to the absence of the cinder-backup service fatal now. The script will now already abort during the initial cleanup phase accordingly:

python3 volume-backup-tester.py --os-cloud pve-devstack --timeout 3
INFO: Performing cleanup for resources with the 'scs-test-' prefix ...
INFO: ↳ deleting volume backup '53b645ed-bb75-4f91-bceb-d61c165b2098' ...
Traceback (most recent call last):
  ...
openstack.exceptions.NotFoundException: NotFoundException: 404: Client Error for url:
http://192.168.144.111/volume/v3/47d9a75089464a7ea72506084e434fd3/backups/53b645ed-bb75-4f91-bceb-d61c165b2098,
Service cinder-backup could not be found.

@markus-hentsch
markus-hentsch merged commit 08b1eeb into main Nov 5, 2024
@markus-hentsch
markus-hentsch deleted the fix/cinder-backup-check-reliability branch November 5, 2024 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] volume-backup-tester.py leaking backup and volume resources

2 participants