Inconsistent usage data for fixed_ip and floating_ip

Bug #1220727 reported by Liyingjun
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Liyingjun

Bug Description

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 |
+---------------------+---------------------+------------+----+----------------------------------+-----------+--------+----------+---------------+---------+----------------------------------+

Changed in nova:
assignee: nobody → Liyingjun (liyingjun)
status: New → In Progress
Changed in nova:
importance: Undecided → Medium
tags: added: grizzly-backport-potential
Changed in nova:
importance: Medium → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/43583
Committed: http://github.com/openstack/nova/commit/f2dfdd4ab37965a6559f3c033cdf877e0fe172be
Submitter: Jenkins
Branch: master

commit f2dfdd4ab37965a6559f3c033cdf877e0fe172be
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: I705f2f9ef327a3198da6a47df772c3a1a28e1b4e

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → havana-rc1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-rc1 → 2013.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/53061

Alan Pevec (apevec)
tags: removed: grizzly-backport-potential
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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