If a normal user created a fixed_ip/floating_ip, a usage record with column `in_use=1` will be created in the quota_usages table, and if an admin user deleted the resource, a new record with column `in_use=-1` will be created..
Reproduce:
# keystone tenant-list
| 21f7a02dbfd94979b83b3b551c78e380 | admin | True |
| 846576498dc24660943784e25e2b5b1a | test | True |
# keystone user-list --tenant-id 846576498dc24660943784e25e2b5b1a
| 6a120d1a6034481fa7e905d422dceb76 | test | True | <email address hidden> |
1. create an instance with user 'test', the quota_usages table should be like this:
+---------------------+---------------------+------------+----+----------------------------------+-----------+--------+----------+---------------+---------+----------------------------------+
| created_at | updated_at | deleted_at | id | project_id | resource | in_use | reserved | until_refresh | deleted | user_id |
+---------------------+---------------------+------------+----+----------------------------------+-----------+--------+----------+---------------+---------+----------------------------------+
| 2013-09-04 13:27:37 | 2013-09-04 13:31:49 | NULL | 30 | 846576498dc24660943784e25e2b5b1a | instances | 1 | 0 | NULL | 0 | 6a120d1a6034481fa7e905d422dceb76 |
| 2013-09-04 13:27:37 | 2013-09-04 13:31:49 | NULL | 31 | 846576498dc24660943784e25e2b5b1a | ram | 512 | 0 | NULL | 0 | 6a120d1a6034481fa7e905d422dceb76 |
| 2013-09-04 13:27:37 | 2013-09-04 13:31:49 | NULL | 32 | 846576498dc24660943784e25e2b5b1a | cores | 1 | 0 | NULL | 0 | 6a120d1a6034481fa7e905d422dceb76 |
| 2013-09-04 13:31:51 | 2013-09-04 13:31:51 | NULL | 33 | 846576498dc24660943784e25e2b5b1a | fixed_ips | 1 | 0 | NULL | 0 | NULL |
+---------------------+---------------------+------------+----+----------------------------------+-----------+--------+----------+---------------+---------+----------------------------------+
2. delete the instance by user 'admin', following is the new table, which is obviously a bug:
+---------------------+---------------------+------------+----+----------------------------------+-----------+--------+----------+---------------+---------+----------------------------------+
| created_at | updated_at | deleted_at | id | project_id | resource | in_use | reserved | until_refresh | deleted | user_id |
+---------------------+---------------------+------------+----+----------------------------------+-----------+--------+----------+---------------+---------+----------------------------------+
| 2013-09-04 13:27:37 | 2013-09-04 13:31:49 | NULL | 30 | 846576498dc24660943784e25e2b5b1a | instances | 0 | 0 | NULL | 0 | 6a120d1a6034481fa7e905d422dceb76 |
| 2013-09-04 13:27:37 | 2013-09-04 13:31:49 | NULL | 31 | 846576498dc24660943784e25e2b5b1a | ram | 0 | 0 | NULL | 0 | 6a120d1a6034481fa7e905d422dceb76 |
| 2013-09-04 13:27:37 | 2013-09-04 13:31:49 | NULL | 32 | 846576498dc24660943784e25e2b5b1a | cores | 0 | 0 | NULL | 0 | 6a120d1a6034481fa7e905d422dceb76 |
| 2013-09-04 13:31:51 | 2013-09-04 13:31:51 | NULL | 33 | 846576498dc24660943784e25e2b5b1a | fixed_ips | 1 | 0 | NULL | 0 | NULL |
| 2013-09-04 13:42:45 | 2013-09-04 13:42:45 | NULL | 34 | 21f7a02dbfd94979b83b3b551c78e380 | fixed_ips | -1 | 0 | NULL | 0 | NULL |
+---------------------+---------------------+------------+----+----------------------------------+-----------+--------+----------+---------------+---------+----------------------------------+
Reviewed: https:/ /review. openstack. org/43583 github. com/openstack/ nova/commit/ f2dfdd4ab37965a 6559f3c033cdf87 7e0fe172be
Committed: http://
Submitter: Jenkins
Branch: master
commit f2dfdd4ab37965a 6559f3c033cdf87 7e0fe172be
Author: liyingjun <email address hidden>
Date: Sat Aug 24 22:02:29 2013 +0800
Fix inconsistent usages for network resources
If a normal user created a fixed_ip/ floating_ ip, a usage record with
column `in_use=1` will be created in the quota_usages table, and if an
admin user deleted the resource, a new record with column `in_use=-1`
will be created..This will cause the quota for the resources not
released.
Fixes bug 1220727
Change-Id: I705f2f9ef327a3 198da6a47df772c 3a1a28e1b4e