Quotas should not be updated to a value lower than current usage

Bug #1304234 reported by shihanzhang
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Low
wanghao

Bug Description

Cinder/Neutron now doesn't check the existing reousrces when user lower the quota sets.

It will bring some confusion to end user.

Simple steps to test:

Step1: Create 3 volumes successfully and the quota limit for volume is 10(default).

Step2: Update the quota set, lower the volume limit to 1. The update operation will be successfully too.

Step3: Create one more volume and get failed since "Maximum number of volumes allowed (1) exceeded".

I knew we have discussed this 'bug' and I understood guys' point about this feature.
But undeniably, I also has received some complains from end users, they feel confusion why the existing resources more than the limits of quota but they can't create any resources any more. So,this maybe is inappropriate as 'bug fix', just want to optimize this API.

Changed in neutron:
assignee: nobody → shihanzhang (shihanzhang)
Changed in cinder:
assignee: nobody → shihanzhang (shihanzhang)
Revision history for this message
Mike Perez (thingee) wrote :

Can you please be more descriptive on how you're updating the quota?

Changed in cinder:
status: New → Incomplete
Revision history for this message
shihanzhang (shihanzhang) wrote :

for example:
#cinder quota-show 8d7c1f20e13b4268af85649a4dac5edc
+-----------+-------+
| Property | Value |
+-----------+-------+
| gigabytes | 1000 |
| snapshots | 10 |
| volumes | 10 |
+-----------+-------+
#cinder quota-update --volumes 8 8d7c1f20e13b4268af85649a4dac5edc
+-----------+-------+
| Property | Value |
+-----------+-------+
| gigabytes | 1000 |
| snapshots | 10 |
| volumes | 8 |
+-----------+-------+
so update the value of quota from large to small, it should failed

Revision history for this message
Mike Perez (thingee) wrote :

I still don't follow, sorry. Behavior seems to be the same in nova: http://paste.openstack.org/show/75807

Revision history for this message
shihanzhang (shihanzhang) wrote :

Hi, Mike, I think you don't get my meaning, in your example, if you already have 10 VMs, then you update the quota of instance to 9, nova will failed

Revision history for this message
Huang Zhiteng (zhiteng-huang) wrote :

Zhang Shihan, if you are saying that Nova doesn't allow updating quota to a level that is lower than quota usage, you should be specific in the bug. Please update the bug report.

Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to neutron (master)

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

Changed in neutron:
status: New → In Progress
Revision history for this message
shihanzhang (shihanzhang) wrote : Re: the problem of updating quota

Hi, Zhiteng Huang, I think it is reasonable in nova, forgive me this question does not make clear, I mean if you have 10 VM in nova and the quota of instance is 20, then you update the quota of instance to 9, nova will tell you shouldn't do this!

Revision history for this message
Mike Perez (thingee) wrote :

shihanzhang, thanks for the clarification. This now makes more sense.

Changed in cinder:
status: Incomplete → Triaged
importance: Undecided → Low
ling-yun (zengyunling)
Changed in cinder:
assignee: shihanzhang (shihanzhang) → ling-yun (zengyunling)
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to cinder (master)

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

Changed in cinder:
status: Triaged → In Progress
Revision history for this message
John Griffith (john-griffith) wrote : Re: the problem of updating quota

I don't know if I see this as a bug. There's a use case in my opinion that a provider or private admin may want to adjust a users quota to a lower level even if it is below what they're currently using. The idea here is that an admin shouldn't be limited to what the user is actually using at the time.

Also, the idea is they may have "N" objects now, but as they delete those objects, we still want to ensure they stay at a new lower quota etc.

Not sure I'm explaining this well, but I don't view this as a bug.

Changed in cinder:
status: In Progress → Invalid
Changed in cinder:
status: Invalid → In Progress
Revision history for this message
Cory Stone (corystone) wrote :

This is certainly not a bug. Why would you restrict the admin's ability to set quotas?

Revision history for this message
Bo Lin (linb) wrote :

Hi Cory, one case is like #7 describes: If you have 10 VM in nova and the quota of instance is 20, then you update the quota of instance to 9, nova will tell you shouldn't do this!

Revision history for this message
Huang Zhiteng (zhiteng-huang) wrote :

I'm sick and tired of people telling me that Nova does this Nova does that and we should do that as well in Cinder. That doesn't necessarily make it a sound reason to do anything.

In a case when admin really want to set the quota for a user, whose quota was 20 instances and already spawned 10, to 5. How could you do that in Nova? Step 1: setting quota to 10, and then setup a script monitor # of instance for that specific user to send yourself a notification. Step 2, cross-finger and wait for the user to shutdown one or more of his/her instances so that you can lower his/her quota even more (hopefully that user didn't boot new instance before you can change the quota). Step 3, iterate step 1 and 2 until you can actually reduce quota to 5?

Revision history for this message
Mike Perez (thingee) wrote :

I also agree with John, Cory and Winston. Berlin, perhaps bring this up to the mailing list to get the users' opinion on this.

summary: - the problem of updating quota
+ Quotas should not be updated to a value lower than current usage
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Huang Zhiteng (<email address hidden>) on branch: master
Review: https://review.openstack.org/87871

wanghao (wanghao749)
Changed in cinder:
assignee: ling-yun (zengyunling) → wanghao (wanghao749)
wanghao (wanghao749)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

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

commit b2abe32ed02649dd2e21fbc945e8863798419450
Author: wanghao <email address hidden>
Date: Thu Jul 2 17:41:17 2015 +0800

    Validate value when user update quota

    Cinder currently doesn't check the existing resource
    when user lowers the quota sets. It should have an optional
    action that doesn't allow to update the quota of resources
    lower than current usage.

    This patch adds code to validate the update value of quota and
    ensure the value can't be lower than existing resource.

    APIImpact
    Add an optional boolean argument 'skip_validation' with default value True.
    {
      "quota_set": {xxxx},
      "skip_validation": 'True'/'False'
    }
    If skip_validation=False and the update value is lower than existing resource,
    API will return 400 Bad Request.

    Change-Id: I24428ce53e5d10e77235f372bb6d0b70ea672412
    Closes-Bug: #1304234

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: liberty-3 → 7.0.0
no longer affects: neutron
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.