Quota error after forced backup of in-use volume

Bug #1778774 reported by Alan Bishop
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Alan Bishop

Bug Description

When a non-admin creates a forced backup of an in-use volume, when the backup completes the volume's quota is deleted from the project's quota usage. This problem does not happen when an admin creates a forced backup.

Steps:
------

1) Become non-admin (. openrc demo demo)
2) Create volume (5 GB)

Quota usage for demo project 7371691aa751491a86cedb46a029a9ac shows one 5 GB
volume:

[stack@devstack devstack]$ cinder quota-usage 7371691aa751491a86cedb46a029a9ac
+-----------------------+--------+----------+-------+-----------+
| Type | In_use | Reserved | Limit | Allocated |
+-----------------------+--------+----------+-------+-----------+
| backup_gigabytes | 0 | 0 | 1000 | |
| backups | 0 | 0 | 10 | |
| gigabytes | 5 | 0 | 1000 | |
| gigabytes_lvmdriver-1 | 5 | 0 | -1 | |
| groups | 0 | 0 | 10 | |
| per_volume_gigabytes | 0 | 0 | -1 | |
| snapshots | 0 | 0 | 10 | |
| snapshots_lvmdriver-1 | 0 | 0 | -1 | |
| volumes | 1 | 0 | 10 | |
| volumes_lvmdriver-1 | 1 | 0 | -1 | |
+-----------------------+--------+----------+-------+-----------+

Steps:
------

3) Spawn an instance and attach the volume
4) Create a (forced) backup of the volume

While the backup is running, quota usage shows the volume, plus one 5 GB
backup:

[stack@devstack devstack]$ cinder quota-usage 7371691aa751491a86cedb46a029a9ac
+-----------------------+--------+----------+-------+-----------+
| Type | In_use | Reserved | Limit | Allocated |
+-----------------------+--------+----------+-------+-----------+
| backup_gigabytes | 5 | 0 | 1000 | |
| backups | 1 | 0 | 10 | |
| gigabytes | 5 | 0 | 1000 | |
| gigabytes_lvmdriver-1 | 5 | 0 | -1 | |
| groups | 0 | 0 | 10 | |
| per_volume_gigabytes | 0 | 0 | -1 | |
| snapshots | 0 | 0 | 10 | |
| snapshots_lvmdriver-1 | 0 | 0 | -1 | |
| volumes | 1 | 0 | 10 | |
| volumes_lvmdriver-1 | 1 | 0 | -1 | |
+-----------------------+--------+----------+-------+-----------+

After the backup completes, the quota usage still shows the 5 GB backup,
but the volume's quota is missing.

[stack@devstack devstack]$ cinder quota-usage 7371691aa751491a86cedb46a029a9ac
+-----------------------+--------+----------+-------+-----------+
| Type | In_use | Reserved | Limit | Allocated |
+-----------------------+--------+----------+-------+-----------+
| backup_gigabytes | 5 | 0 | 1000 | |
| backups | 1 | 0 | 10 | |
| gigabytes | 0 | 0 | 1000 | |
| gigabytes_lvmdriver-1 | 0 | 0 | -1 | |
| groups | 0 | 0 | 10 | |
| per_volume_gigabytes | 0 | 0 | -1 | |
| snapshots | 0 | 0 | 10 | |
| snapshots_lvmdriver-1 | 0 | 0 | -1 | |
| volumes | 0 | 0 | 10 | |
| volumes_lvmdriver-1 | 0 | 0 | -1 | |
+-----------------------+--------+----------+-------+-----------+

[stack@devstack devstack]$ openstack volume list
+--------------------------------------+------+--------+------+-----------------------------+
| ID | Name | Status | Size | Attached to |
+--------------------------------------+------+--------+------+-----------------------------+
| b1fa0ccc-98c1-4749-a64a-dae1c17f280e | vol | in-use | 5 | Attached to vm on /dev/vdb |
+--------------------------------------+------+--------+------+-----------------------------+

Changed in cinder:
assignee: nobody → Alan Bishop (alan-bishop)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/578201

Changed in cinder:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/578201
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=8d9f8629013bcb880fb3e33f03b274c10befdab0
Submitter: Zuul
Branch: master

commit 8d9f8629013bcb880fb3e33f03b274c10befdab0
Author: Alan Bishop <email address hidden>
Date: Tue Jun 26 16:37:12 2018 -0400

    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

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/579267

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/queens)

Reviewed: https://review.openstack.org/579267
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=23729bdda4099908a205f6d60f64ffad712f820e
Submitter: Zuul
Branch: stable/queens

commit 23729bdda4099908a205f6d60f64ffad712f820e
Author: Alan Bishop <email address hidden>
Date: Tue Jun 26 16:37:12 2018 -0400

    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
    (cherry picked from commit 8d9f8629013bcb880fb3e33f03b274c10befdab0)

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/pike)

Fix proposed to branch: stable/pike
Review: https://review.openstack.org/579692

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/pike)

Reviewed: https://review.openstack.org/579692
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=9bd60bbdb997c07ce22d590dfc66272ac5325836
Submitter: Zuul
Branch: stable/pike

commit 9bd60bbdb997c07ce22d590dfc66272ac5325836
Author: Alan Bishop <email address hidden>
Date: Tue Jun 26 16:37:12 2018 -0400

    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
    (cherry picked from commit 8d9f8629013bcb880fb3e33f03b274c10befdab0)
    (cherry picked from commit 23729bdda4099908a205f6d60f64ffad712f820e)

tags: added: in-stable-pike
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 13.0.0.0b3

This issue was fixed in the openstack/cinder 13.0.0.0b3 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 12.0.4

This issue was fixed in the openstack/cinder 12.0.4 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 11.2.0

This issue was fixed in the openstack/cinder 11.2.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.