tenant is required for quota-update but not for quota-show

Bug #1313935 reported by Corey Bryant
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Cinder
Incomplete
Medium
Kasey Alusi
OpenStack Compute (nova)
Triaged
Medium
Ankur Gupta
nova (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

Tenant is a required positional parameter on quota-update but is optional on quota-show. And when --tenant is not specified on quota-show it doesn't return valid limits for the user.

$ nova quota-show --user demo
+-----------------------------+-------+
| Quota | Limit |
+-----------------------------+-------+
| instances | 10 |
...
+-----------------------------+-------+

$ nova quota-update --user demo --instances 9 # tenant is required
usage: nova quota-update [--user <user-id>] [--instances <instances>]
                         [--cores <cores>] [--ram <ram>]
                         [--floating-ips <floating-ips>]
                         [--fixed-ips <fixed-ips>]
                         [--metadata-items <metadata-items>]
                         [--injected-files <injected-files>]
                         [--injected-file-content-bytes <injected-file-content-bytes>]
                         [--injected-file-path-bytes <injected-file-path-bytes>]
                         [--key-pairs <key-pairs>]
                         [--security-groups <security-groups>]
                         [--security-group-rules <security-group-rules>]
                         [--force]
                         <tenant-id>
error: too few arguments
Try 'nova help quota-update' for more information.

$ nova quota-update --user demo --instances 9 demo

$ nova quota-show --user demo # should return instances=9 or should fail because tenant is required
+-----------------------------+-------+
| Quota | Limit |
+-----------------------------+-------+
| instances | 10 |
...
+-----------------------------+-------+

$ nova quota-show --user demo --tenant demo # returns the correct value
+-----------------------------+-------+
| Quota | Limit |
+-----------------------------+-------+
| instances | 9 |
...
+-----------------------------+-------+

Thang Pham (thang-pham)
Changed in nova:
assignee: nobody → Thang Pham (thang-pham)
Revision history for this message
Thang Pham (thang-pham) wrote :

The problem is nova quota-update uses value of <tenant-id> to save the quota in the database. If you use "demo" as the tenant-id, nova will use project_id="demo" when setting the project_user_quotas table. If you use a <uuid> as the tenant-id, nova will use project_id=<uuid> when setting the project_user_quotas table. You can see this by logging into MySQL (or whatever DB you are using) and querying the project_user_quotas table (e.g. select project_id,resource,hard_limit from project_user_quotas).

In order to obtain the correct values, you have to pass the correct <tenant-id> in nova quota-show. The solution to this bug is to: translate the tenant name into its <uuid> before saving it into the DB or querying from the database.

Revision history for this message
Thang Pham (thang-pham) wrote :

Another solution is: check that the <tenant-id> is actually a valid uuid.

Thang Pham (thang-pham)
Changed in nova:
importance: Undecided → Medium
Thang Pham (thang-pham)
Changed in nova:
status: New → In Progress
Thang Pham (thang-pham)
Changed in cinder:
assignee: nobody → Thang Pham (thang-pham)
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to nova (master)

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

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in nova (Ubuntu):
status: New → Confirmed
James Page (james-page)
Changed in nova (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Joe Gordon (<email address hidden>) on branch: master
Review: https://review.openstack.org/91866
Reason: Is this still active? Nothing has happened in a few months marking as abandoned. Feel free to bring it back.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Thang Pham (<email address hidden>) on branch: master
Review: https://review.openstack.org/91866
Reason: Abandoning this patch, so a new patch can be spun up with updated code.

Joe Gordon (jogo)
Changed in nova:
status: In Progress → New
assignee: Thang Pham (thang-pham) → nobody
Mike Perez (thingee)
Changed in cinder:
milestone: none → kilo-1
status: New → Triaged
importance: Undecided → Medium
Changed in nova:
assignee: nobody → Kanchan Gupta (kanchan-gupta1)
Changed in nova:
assignee: Kanchan Gupta (kanchan-gupta1) → nobody
melanie witt (melwitt)
Changed in nova:
status: New → Triaged
Mike Perez (thingee)
tags: added: low-hanging-fruit
Changed in cinder:
assignee: Thang Pham (thang-pham) → nobody
milestone: kilo-1 → kilo-2
Revision history for this message
Anton Arefiev (aarefiev) wrote :

Cinder quota-show and quota-update have only positional arg <tenant_id>.

Changed in cinder:
status: Triaged → Incomplete
Mike Perez (thingee)
Changed in cinder:
milestone: kilo-2 → none
Changed in nova:
assignee: nobody → Ankur Gupta (ankur-gupta-v)
Changed in cinder:
assignee: nobody → Kasey Alusi (kasey-alusi)
status: Incomplete → Confirmed
Changed in cinder:
status: Confirmed → Incomplete
Joe Gordon (jogo)
tags: added: quotas
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

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