Fix quota error when deleting temporary volume
When deleting a volume, always use the admin context to fetch the admin_metadata that indicates whether it's a temporary volume. This fixes a bug where a non-admin user failed to retrieve the admin_metadata, which caused the volume to not be treated as temporary. This, in turn, caused quota usage to be incorrectly updated. Closes-Bug: #1778774 Change-Id: I8e6b0c726dc6498b28795a1ea0520ef05e53f047
This commit is contained in:
parent
fc19a0dca8
commit
8d9f862901
@ -763,11 +763,12 @@ class VolumeManager(manager.CleanableManager,
|
||||
|
||||
# To backup a snapshot or a 'in-use' volume, create a temp volume
|
||||
# from the snapshot or in-use volume, and back it up.
|
||||
# Get admin_metadata to detect temporary volume.
|
||||
# Get admin_metadata (needs admin context) to detect temporary volume.
|
||||
is_temp_vol = False
|
||||
if volume.admin_metadata.get('temporary', 'False') == 'True':
|
||||
is_temp_vol = True
|
||||
LOG.info("Trying to delete temp volume: %s", volume.id)
|
||||
with volume.obj_as_admin():
|
||||
if volume.admin_metadata.get('temporary', 'False') == 'True':
|
||||
is_temp_vol = True
|
||||
LOG.info("Trying to delete temp volume: %s", volume.id)
|
||||
|
||||
# The status 'deleting' is not included, because it only applies to
|
||||
# the source volume to be deleted after a migration. No quota
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fix a quota usage error triggered by a non-admin user backing up an
|
||||
in-use volume. The forced backup uses a temporary volume, and quota
|
||||
usage was incorrectly updated when the temporary volume was deleted
|
||||
after the backup operation completed.
|
||||
Fixes `bug 1778774 <https://bugs.launchpad.net/tripleo/+bug/1778774>`__.
|
Loading…
Reference in New Issue
Block a user