quota not considered when import backup resource

Bug #1783525 reported by TommyLike
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Jay Bryant

Bug Description

When import backup resource, cinder doesn't consume any backup related quotas, but when the imported backup resource is deleted, the quota will be decreased.

Step to reproduce:
1. import backup and show quota usage:
```
➜ ~ cinder backup-import cinder.backup.drivers.swift.SwiftBackupDriver eyJzdGF0dXMiOiAiYXZhaWxhYmxlIiwgInRlbXBfc25hcHNob3RfaWQiOiBudWxsLCAiZGlzcGxheV9uYW1lIjogbnVsbCwgImF2YWlsYWJpbGl0eV96b25lIjogIm5vdmEiLCAiZGVsZXRlZCI6IGZhbHNlLCAidm9sdW1lX2lkIjogImE4NjQ5MWI5LTI2ZTUtNGFmZi04MzkwLWY0OGNiMjcwOTZhNiIsICJyZXN0b3JlX3ZvbHVtZV9pZCI6IG51bGwsICJ1cGRhdGVkX2F0IjogIjIwMTgtMDctMjVUMDg6Mzc6NDZaIiwgImhvc3QiOiAiZWNzLWVjZmYtMDAwMSIsICJzbmFwc2hvdF9pZCI6IG51bGwsICJ1c2VyX2lkIjogImVlYTNiMTdjZDdiNjQzNDQ4OWJhOWFlMjNhY2VlYTk5IiwgInNlcnZpY2VfbWV0YWRhdGEiOiAidm9sdW1lX2E4NjQ5MWI5LTI2ZTUtNGFmZi04MzkwLWY0OGNiMjcwOTZhNi8yMDE4MDcyNTA4MzcyNC9hel9ub3ZhX2JhY2t1cF8yYzhjNzhiYi0zOTA4LTQyODQtYWVlOS0yMzQ0NDhiMmJmNGEiLCAiaWQiOiAiMmM4Yzc4YmItMzkwOC00Mjg0LWFlZTktMjM0NDQ4YjJiZjRhIiwgInNpemUiOiAxLCAib2JqZWN0X2NvdW50IjogMjIsICJkZWxldGVkX2F0IjogbnVsbCwgImNvbnRhaW5lciI6ICJ2b2x1bWViYWNrdXBzIiwgInNlcnZpY2UiOiAiY2luZGVyLmJhY2t1cC5kcml2ZXJzLnN3aWZ0LlN3aWZ0QmFja3VwRHJpdmVyIiwgImRyaXZlcl9pbmZvIjoge30sICJjcmVhdGVkX2F0IjogIjIwMTgtMDctMjVUMDg6Mzc6MjBaIiwgImRpc3BsYXlfZGVzY3JpcHRpb24iOiBudWxsLCAiZGF0YV90aW1lc3RhbXAiOiAiMjAxOC0wNy0yNVQwODozNzoyMFoiLCAidGVtcF92b2x1bWVfaWQiOiBudWxsLCAicGFyZW50X2lkIjogbnVsbCwgImVuY3J5cHRpb25fa2V5X2lkIjogbnVsbCwgIm51bV9kZXBlbmRlbnRfYmFja3VwcyI6IDAsICJmYWlsX3JlYXNvbiI6IG51bGwsICJwcm9qZWN0X2lkIjogIjMzZTY3OGU0MDRlZTRkOGM4ZWJhYThmY2ZhMjE5ZGQxIiwgIm1ldGFkYXRhIjoge319
+----------+--------------------------------------+
| Property | Value |
+----------+--------------------------------------+
| id | 2c8c78bb-3908-4284-aee9-234448b2bf4a |
| name | None |
+----------+--------------------------------------+
➜ ~ cinder quota-usage ea2e3ae4fdd84472b6332df15bafaf85
+----------------------+--------+----------+-------+-----------+
| Type | In_use | Reserved | Limit | Allocated |
+----------------------+--------+----------+-------+-----------+
| backup_gigabytes | 0 | 0 | 1000 | |
| backups | 0 | 0 | 10 | |
| gigabytes | 0 | 0 | 1000 | |
| groups | 0 | 0 | 10 | |
| per_volume_gigabytes | 0 | 0 | -1 | |
| snapshots | 0 | 0 | 10 | |
| volumes | 0 | 0 | 10 | |
+----------------------+--------+----------+-------+-----------+
```
2. create a new backup and show quota usage:
```
cinder backup-create 3a8c6127-a5ea-4179-b969-0ca1f7f009ea
+-----------+--------------------------------------+
| Property | Value |
+-----------+--------------------------------------+
| id | efbd7f3a-06ea-4ae1-ad17-61f8c8b2ef69 |
| name | None |
| volume_id | 3a8c6127-a5ea-4179-b969-0ca1f7f009ea |
+-----------+--------------------------------------+
➜ ~ cinder backup-list
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+---------------+
| ID | Volume ID | Status | Name | Size | Object Count | Container |
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+---------------+
| 2c8c78bb-3908-4284-aee9-234448b2bf4a | a86491b9-26e5-4aff-8390-f48cb27096a6 | available | - | 1 | 22 | volumebackups |
| efbd7f3a-06ea-4ae1-ad17-61f8c8b2ef69 | 3a8c6127-a5ea-4179-b969-0ca1f7f009ea | available | - | 1 | 22 | volumebackups |
+--------------------------------------+--------------------------------------+-----------+------+------+--------------+---------------+
➜ ~ cinder quota-usage ea2e3ae4fdd84472b6332df15bafaf85
+----------------------+--------+----------+-------+-----------+
| Type | In_use | Reserved | Limit | Allocated |
+----------------------+--------+----------+-------+-----------+
| backup_gigabytes | 1 | 0 | 1000 | |
| backups | 1 | 0 | 10 | |
| gigabytes | 1 | 0 | 1000 | |
| groups | 0 | 0 | 10 | |
| per_volume_gigabytes | 0 | 0 | -1 | |
| snapshots | 0 | 0 | 10 | |
| volumes | 1 | 0 | 10 | |
+----------------------+--------+----------+-------+-----------+
```
3. delete imported backup resource and show quota usage:
```
cinder backup-delete 2c8c78bb-3908-4284-aee9-234448b2bf4a
Request to delete backup 2c8c78bb-3908-4284-aee9-234448b2bf4a has been accepted.
➜ ~ cinder quota-usage ea2e3ae4fdd84472b6332df15bafaf85
+----------------------+--------+----------+-------+-----------+
| Type | In_use | Reserved | Limit | Allocated |
+----------------------+--------+----------+-------+-----------+
| backup_gigabytes | 0 | 0 | 1000 | |
| backups | 0 | 0 | 10 | |
| gigabytes | 1 | 0 | 1000 | |
| groups | 0 | 0 | 10 | |
| per_volume_gigabytes | 0 | 0 | -1 | |
| snapshots | 0 | 0 | 10 | |
| volumes | 1 | 0 | 10 | |
+----------------------+--------+----------+-------+-----------+
```

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/585941

Changed in cinder:
assignee: nobody → TommyLike (hu-husheng)
status: New → In Progress
Changed in cinder:
assignee: TommyLike (hu-husheng) → Jay Bryant (jsbryant)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/585941
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=4b4fbd35da26c7d697ddf18d3f0487f9ea817224
Submitter: Zuul
Branch: master

commit 4b4fbd35da26c7d697ddf18d3f0487f9ea817224
Author: TommyLike <email address hidden>
Date: Thu Jul 26 11:08:15 2018 +0800

    Consume quota when importing backup resource

    Now cinder will validate&consume backup quotas when
    importing new backup resource.

    Change-Id: I1825600dc6e01499c8fc4ede05400a180672e130
    Closes-Bug:#1783525

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 13.0.0.0rc1

This issue was fixed in the openstack/cinder 13.0.0.0rc1 release candidate.

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/626909

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/626922

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

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

commit acf16280a48dffbf21358b1c3b7484445c0a2b7c
Author: TommyLike <email address hidden>
Date: Thu Jul 26 11:08:15 2018 +0800

    Consume quota when importing backup resource

    Now cinder will validate&consume backup quotas when
    importing new backup resource.

    Change-Id: I1825600dc6e01499c8fc4ede05400a180672e130
    Closes-Bug:#1783525
    (cherry picked from commit 4b4fbd35da26c7d697ddf18d3f0487f9ea817224)

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

Reviewed: https://review.openstack.org/626909
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=40f5aef94a88a55cd20aad02e4f9ff2c38943b77
Submitter: Zuul
Branch: stable/pike

commit 40f5aef94a88a55cd20aad02e4f9ff2c38943b77
Author: TommyLike <email address hidden>
Date: Thu Jul 26 11:08:15 2018 +0800

    Consume quota when importing backup resource

    Now cinder will validate&consume backup quotas when
    importing new backup resource.

    Change-Id: I1825600dc6e01499c8fc4ede05400a180672e130
    Closes-Bug:#1783525
    (cherry picked from commit 4b4fbd35da26c7d697ddf18d3f0487f9ea817224)

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

This issue was fixed in the openstack/cinder 12.0.5 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.