cinder/cinder/objects
Gorka Eguileor 94dfad99c2 Improve quota usage for temporary resources
Cinder creates temporary resources, volumes and snapshots, during some
of its operations, and these resources aren't counted towards quota
usage.

Cinder currently has a problem to track quota usage is when deleting
temporary resources.

Determining which volumes are temporary is a bit inconvenient because we
have to check the migration status as well as the admin metadata, so
they have been the source of several bugs, though they should be
properly tracked now.

For snapshots we don't have any way to track which ones are temporary,
which creates some issues:

- Quota sync mechanism will count them as normal snapshots.

- Manually deleting temporary snapshots after an operation fails will
  mess the quota.

- If we are using snapshots instead of clones for backups of in-use
  volumes the quota will be messed on completion.

This patch proposes the introduction of a new field for those database
resource tables where we create temporary resources: volumes and
snaphots.

The field will be called "use_quota" and will be set to False for
temporary resources to indicate that we don't want them to be counted
towards quota on deletion.

Instead of using "temporary" as the field name "use_quota" was used to
allow other cases that should not do quota in the future.

Moving from our current mechanism to the new one is a multi-release
process because we need to have backward compatibility code for rolling
upgrades.

This patch adds everything needed to complete the multi-release process
so that anybody can submit next release patches.  To do so the patch
adds backward compatible code adding the feature in this release and
TODO comments with the exact changes that need to be done for the next
2 releases.

The removal of the compatibility code will be done in the next release,
and in the one after that we'll remove the temporary metadata rows that
may still exist in the database.

With this new field we'll be able to make our DB queries more efficient
for quota usage calculations, reduce the chances of introducing new
quota usage bugs in the future, and allow users to filter in/out
temporary volumes on listings.

Closes-Bug: #1923828
Closes-Bug: #1923829
Closes-Bug: #1923830
Implements: blueprint temp-resources
Change-Id: I98bd4d7a54906b613daaf14233d749da1e1531d5
2021-08-26 18:47:27 +02:00
..
__init__.py Add service dynamic log change/query 2017-05-16 13:37:35 +02:00
backup.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
base.py Improve quota usage for temporary resources 2021-08-26 18:47:27 +02:00
cgsnapshot.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
cleanable.py Remove collections.abc backwards compatibility 2020-10-16 07:52:36 -05:00
cleanup_request.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
cluster.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
consistencygroup.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
dynamic_log.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
fields.py Adding missing Volume states to VolumeStatus enum 2018-12-06 22:58:55 +05:30
group.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
group_snapshot.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
group_type.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
manageableresources.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
qos_specs.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
request_spec.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
service.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
snapshot.py Improve quota usage for temporary resources 2021-08-26 18:47:27 +02:00
volume.py Improve quota usage for temporary resources 2021-08-26 18:47:27 +02:00
volume_attachment.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00
volume_type.py Clear OVO history and compatibility 2021-08-25 17:50:48 +02:00