diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index eff70bec100..33cd396160a 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -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 diff --git a/releasenotes/notes/fix-quota-deleting-temporary-volume-274e371b425e92cc.yaml b/releasenotes/notes/fix-quota-deleting-temporary-volume-274e371b425e92cc.yaml new file mode 100644 index 00000000000..33d31982278 --- /dev/null +++ b/releasenotes/notes/fix-quota-deleting-temporary-volume-274e371b425e92cc.yaml @@ -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 `__.