resource creation fails when per-tenant quota is enabled

Bug #1101331 reported by Akihiro Motoki
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
High
Alex Xu

Bug Description

When per-tenant quota is enabled, net-create fails with the following error.

It can be fixed by changing the last line of _get_quotas() in quantum/db/quota_db.py to "return quotas".
There seems to be no tests for quota_db.

2013-01-19 01:33:02.525 10907 ERROR quantum.api.v2.resource [-] create failed
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource Traceback (most recent call last):
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource File "/opt/stack/quantum/quantum/api/v2/resource.py", line 96, in
 resource
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource result = method(request=request, **args)
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource File "/opt/stack/quantum/quantum/api/v2/base.py", line 302, in cr
eate
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource **kwargs)
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource File "/opt/stack/quantum/quantum/quota.py", line 257, in limit_ch
eck
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource self._resources, values)
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource File "/opt/stack/quantum/quantum/db/quota_db.py", line 185, in li
mit_check
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource quotas = self._get_quotas(context, tenant_id, resources, values
.keys())
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource File "/opt/stack/quantum/quantum/db/quota_db.py", line 154, in _g
et_quotas
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource return dict((k, v['limit']) for k, v in quotas.items())
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource File "/opt/stack/quantum/quantum/db/quota_db.py", line 154, in <g
enexpr>
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource return dict((k, v['limit']) for k, v in quotas.items())
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource TypeError: 'int' object has no attribute '__getitem__'
2013-01-19 01:33:02.525 10907 TRACE quantum.api.v2.resource

dan wendlandt (danwent)
Changed in quantum:
importance: Undecided → High
milestone: none → grizzly-3
tags: added: folsom-backport-potential
tags: added: low-hanging-fruit
Revision history for this message
Akihiro Motoki (amotoki) wrote :

I tested with stable/folsom and this issue does not happen, so I removed folsom-backport-potential tag.

tags: removed: folsom-backport-potential
Revision history for this message
dan wendlandt (danwent) wrote :

thanks akihiro. are you planning on fixing this, or should i ask for someone in the meeting?

Revision history for this message
Akihiro Motoki (amotoki) wrote :

I will take it. (I thought I have already assigned to me but I haven't).

I identified the cause and it is easy to fix.

The problem is quota db driver has no unit test and it should be written. It will takes some time.

Changed in quantum:
assignee: nobody → Akihiro Motoki (amotoki)
Changed in quantum:
status: New → Confirmed
Revision history for this message
Salvatore Orlando (salvatore-orlando) wrote :

Akihiro - please note that there's already a patch under review for this, and seems to be working fine: https://review.openstack.org/#/c/20377/

Changed in quantum:
assignee: Akihiro Motoki (amotoki) → Alex Xu (xuhj)
status: Confirmed → In Progress
Revision history for this message
Alex Xu (xuhj) wrote :

Hi, Akihiro, sorry for didn't found this bug have already filed, I have submitted one patch for this https://review.openstack.org/#/c/20377/ Thanks.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to quantum (master)

Reviewed: https://review.openstack.org/20377
Committed: http://github.com/openstack/quantum/commit/e1006d921628e84d9263cb27b24f6c7e44468e44
Submitter: Jenkins
Branch: master

commit e1006d921628e84d9263cb27b24f6c7e44468e44
Author: He Jie Xu <email address hidden>
Date: Thu Jan 24 15:26:55 2013 +0800

    Fixes per tenant quota doesn't work

    Fixes bug 1101331

    Change-Id: I9c4e88b437506ed5818ee56ff6fd70588cb0f965

Changed in quantum:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in quantum:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in quantum:
milestone: grizzly-3 → 2013.1
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.