Create volume ignores allocated quota values of the parent project

Bug #1505801 reported by Erickson Filipe Guedes dos Santos
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
High
Raildo Mascena de Sousa Filho

Bug Description

We have discovered in Cinder that the sum of the allocated quotas and in_usage quotas can be greater than the the hard_limit quota of a project. The reason is that, by creating resources, first, Cinder tries to reserve the quota. Then, the method db.quota_reserve is called and there is no checking regarding the allocated values of the project (see https://github.com/openstack/cinder/blob/master/cinder/db/sqlalchemy/api.py#L872-L874).

Steps to reproduce:
1. openstack project create A

#grant the role admin to the user in this project.
2. openstack role add admin --project A --user admin

#create a subproject of A
3. openstack project create B --property parent_id=<project id of A>

#grant the role admin to the user in this project.
4. openstack role add admin --project B --user admin

#allocate all volume quota of project A to project B
5. openstack quota set <project id of B> --volumes 10

#create a volume in project A, it should not be allowed since it was allocated all the quota of project A to project B.
6. openstack volume create --size 1 test_volume

In the step 6, the volume isn't expected to be created because project A doesn't have any more free quota. But, in the current implementation, Cinder is allowing the creation of the volume.

Changed in cinder:
assignee: nobody → Erickson Filipe Guedes dos Santos (ericksonfilipe)
Changed in cinder:
status: New → Confirmed
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/240046

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

Changed in cinder:
assignee: Erickson Filipe Guedes dos Santos (ericksonfilipe) → Raildo Mascena de Sousa Filho (raildo)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (stable/liberty)

Change abandoned by Raildo Mascena de Sousa Filho (<email address hidden>) on branch: stable/liberty
Review: https://review.openstack.org/240046
Reason: abandon in order to commit on master and later do the backport: https://review.openstack.org/240228

tags: added: liberty-backport-potential
wanghao (wanghao749)
Changed in cinder:
milestone: none → mitaka-3
Jay Bryant (jsbryant)
Changed in cinder:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/240228
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=5e5c66be483029c6b5861d8c268f1df345850a0d
Submitter: Jenkins
Branch: master

commit 5e5c66be483029c6b5861d8c268f1df345850a0d
Author: Raildo Mascena <email address hidden>
Date: Wed Oct 28 17:50:44 2015 -0300

    Include allocated quota value in the quota reserve

    When we do a quota_reserve in a project, the allocated quota for their
    subprojects was not considered in the over quota calculation

    Co-Authored-By: Paulo Ewerton <email address hidden>

    Change-Id: Ia72e13a40e00c4ec0e986b80a7c9a322f3df659d
    Closes-Bug: #1505801

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/cinder 8.0.0.0b3

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

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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