]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Fix quota updating when admin deletes common user's volume
authorYug Suo <yugsuo@gmail.com>
Mon, 11 Mar 2013 08:30:07 +0000 (16:30 +0800)
committerJohn Griffith <john.griffith@solidfire.com>
Wed, 27 Mar 2013 04:35:05 +0000 (22:35 -0600)
commit85b7453f68f76dcd6edd7043026e7a6676eadf23
tree5e79725931dd8a77cef2e1e5cc36983ebb44e7cd
parent3a9fcc337cd0eaa1412a1f5fc634ce03fa6c6f0d
Fix quota updating when admin deletes common user's volume

Add 'project_id=None' optional argument in QUOTAS related methods.

There are two problems when admin deletes volumes of common user
before fixing this bug:
Firstly, It will get tenant quotas using context.project_id which
results in getting admin's quotas not common user's.
Secondly, It will also get wrong quota usages using context.project_id
when updating common user's quota_usages.

So we could pass into QUOTAS related methods an optional argument to
specify the tenant ID to be affected. And if it's not set, then we
default to drawing the tenant ID from the context.

Fixes: bug 1078668
Change-Id: Ie250da84726d1c5c3280430038184000dfd1e9e2
(cherry picked from commit 576c9b0880c32bfc8053550b8f25a76df98c60e4)
cinder/db/api.py
cinder/db/sqlalchemy/api.py
cinder/quota.py
cinder/tests/test_quota.py
cinder/tests/test_volume.py
cinder/volume/api.py
cinder/volume/manager.py