← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1078668] Re: wrong quota_usages updated when admin deletes instance of common user

 

Reviewed:  https://review.openstack.org/25490
Committed: http://github.com/openstack/cinder/commit/85b7453f68f76dcd6edd7043026e7a6676eadf23
Submitter: Jenkins
Branch:    milestone-proposed

commit 85b7453f68f76dcd6edd7043026e7a6676eadf23
Author: Yug Suo <yugsuo@xxxxxxxxx>
Date:   Mon Mar 11 16:30:07 2013 +0800

    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)


** Changed in: cinder
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1078668

Title:
  wrong quota_usages updated when admin deletes instance of common user

Status in Cinder:
  Fix Released
Status in OpenStack Compute (Nova):
  Fix Released

Bug description:
  When admin with admin project delete a instance of common user, QUOTA
  will update the admin project quota_usages,  but I except QUOTA to
  update the quota_usages  common user project. Below is my tests in
  devstack.

  
  "the demo project _id is f293f8518b67465bb47af717c075e619.
  "the admin project_id is 69d65864ae8242b580649252cacedaa3.

  $ source openrc demo demo
  $ nova boot --flavor=1 --image=89a0484b-a539-4c7b-b549-36c3c56fdcff test1
  "the instance of demo project is e74c9b03-07d4-4988-96eb-ab7bc75411b1.

  $ source openrc admin admin
  $ nova boot --flavor=1 --image=89a0484b-a539-4c7b-b549-36c3c56fdcff test2
  "the instance of admin project is 627f8491-9425-4364-aa1b-ec02a42f946b.

  $ nova list --all-tenants=1
  +--------------------------------------+-------+--------+------------------+
  | ID                                   | Name  | Status | Networks         |
  +--------------------------------------+-------+--------+------------------+
  | e74c9b03-07d4-4988-96eb-ab7bc75411b1 | test1 | ACTIVE | private=10.0.0.2 |
  | 627f8491-9425-4364-aa1b-ec02a42f946b | test2 | ACTIVE | private=10.0.0.3 |
  +--------------------------------------+-------+--------+------------------+

  $ source openrc admin admin
  $ nova delete e74c9b03-07d4-4988-96eb-ab7bc75411b1
  $ nova list --all-tenants=1
  +--------------------------------------+-------+--------+------------------+
  | ID                                   | Name  | Status | Networks         |
  +--------------------------------------+-------+--------+------------------+
  | 627f8491-9425-4364-aa1b-ec02a42f946b | test2 | ACTIVE | private=10.0.0.3 |
  +--------------------------------------+-------+--------+------------------+

  
  mysql> select * from quota_usages;
  +---------------------+---------------------+------------+---------+----+----------------------------------+-----------+--------+----------+---------------+
  | created_at          | updated_at          | deleted_at | deleted | id | project_id                       | resource  | in_use | reserved | until_refresh |
  +---------------------+---------------------+------------+---------+----+----------------------------------+-----------+--------+----------+---------------+
  | 2012-11-08 10:58:51 | 2012-11-14 11:08:01 | NULL       |       0 |  1 | f293f8518b67465bb47af717c075e619 | instances |      1 |        0 |          NULL |
  | 2012-11-08 10:58:51 | 2012-11-14 11:08:01 | NULL       |       0 |  2 | f293f8518b67465bb47af717c075e619 | ram       |    512 |        0 |          NULL |
  | 2012-11-08 10:58:51 | 2012-11-14 11:08:01 | NULL       |       0 |  3 | f293f8518b67465bb47af717c075e619 | cores     |      1 |        0 |          NULL |
  | 2012-11-13 16:56:47 | 2012-11-14 11:09:45 | NULL       |       0 |  4 | 69d65864ae8242b580649252cacedaa3 | instances |      0 |        0 |          NULL |
  | 2012-11-13 16:56:47 | 2012-11-14 11:09:45 | NULL       |       0 |  5 | 69d65864ae8242b580649252cacedaa3 | ram       |      0 |        0 |          NULL |
  | 2012-11-13 16:56:47 | 2012-11-14 11:09:45 | NULL       |       0 |  6 | 69d65864ae8242b580649252cacedaa3 | cores     |      0 |        0 |          NULL |
  +---------------------+---------------------+------------+---------+----+----------------------------------+-----------+--------+----------+---------------+
  6 rows in set (0.00 sec)

To manage notifications about this bug go to:
https://bugs.launchpad.net/cinder/+bug/1078668/+subscriptions