Quota info in DB for floatingip is not updated immediately

Bug #1533687 reported by Sergey Belous
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Undecided
Sergey Belous

Bug Description

The records in quotausages table for floatingip are not updated immediately after delete some (or all) floatingips.
For example, if we set quota for floatingip to 5, create 5 floatingips and remove all of them, after that we can't create new floatingip:
The error "Quota exceeded for resources: ['floatingip']." occurs.
And at this time in mysql db we can see following:
mysql> select * from quotausages;
+----------------------------------+------------+-------+--------+----------+
| tenant_id | resource | dirty | in_use | reserved |
+----------------------------------+------------+-------+--------+----------+
| fae4b729e0d543199331d6be300074fc | floatingip | 0 | 5 | 0 |
| fae4b729e0d543199331d6be300074fc | network | 0 | 1 | 0 |
+----------------------------------+------------+-------+--------+----------+

Steps to reproduce:
1. $ neutron quota-update --floatingip 5
2. $ for i in $(seq 1 5); do neutron floatingip-create public; done
3. Try to create another one floatingip (should not be created):
$ neutron floatingip-create public
Quota exceeded for resources: ['floatingip'].
4. $ for ip in $(neutron floatingip-list -f csv -c id --quote=none | grep -v id); do neutron floatingip-delete $ip done
5. Try to create another one floatingip:
$ neutron floatingip-create public
Quota exceeded for resources: ['floatingip'].
6. Check quotas info in db:
mysql> use neutron
mysql> select * from quotausages;

Full log here: http://paste.openstack.org/show/483767/

Sergey Belous (sbelous)
summary: - Quota info in bd for floatingip is not updated immediately
+ Quota info in DB for floatingip is not updated immediately
description: updated
description: updated
description: updated
Sergey Belous (sbelous)
Changed in neutron:
assignee: nobody → Sergey Belous (sbelous)
Sergey Belous (sbelous)
Changed in neutron:
status: New → In Progress
Revision history for this message
Marcus Klein (marcus-klein) wrote :

It is even worse than that. I can see big differences in my setup between actually allocated floating IPs and the value in the quotausages table. See https://bugs.launchpad.net/mos/+bug/1527581.

mysql> SELECT q.tenant_id,q.in_use,COUNT(f.floating_ip_address) AS floating_ips FROM quotausages q LEFT JOIN floatingips f USING(tenant_id) WHERE q.resource='floatingip' GROUP BY q.tenant_id;
+----------------------------------+--------+--------------+
| tenant_id | in_use | floating_ips |
+----------------------------------+--------+--------------+
| 08609b63401f43679af078d4c22f3f08 | 4 | 4 |
| 3a1e97ffa74f429b8c275fe2ff90c1db | 2 | 2 |
| 7829521236b143d2a6778e09ba588ec0 | 10 | 0 |
| 8d04de0a40cc4419aed0d33a8d5e8eee | 19 | 19 |
| d7400e965d5a40a79708649ae64a9d85 | 1 | 0 |
| f62d544271e6416ba1d334e26133461d | 5 | 5 |
+----------------------------------+--------+--------------+
6 rows in set (0.00 sec)

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

Fix proposed to branch: master
Review: https://review.openstack.org/269050

Revision history for this message
guiyanxing (guiyanxing) wrote :

while in devstack enviroment, didn't find this prolem.

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

Reviewed: https://review.openstack.org/269050
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=c82f0021d50a19861da12e112fb8756d49d1b804
Submitter: Jenkins
Branch: master

commit c82f0021d50a19861da12e112fb8756d49d1b804
Author: Sergey Belous <email address hidden>
Date: Mon Jan 18 16:37:06 2016 +0300

    Add relationship between port and floating ip

    We need to have the relationship between port and floating ip, because updating
    quota will happen when the event "after_delete" occurs. And current cascade
    removal of the floating ip does not cause the event "after_delete" for floating
    ip. The cascade on the ORM-level "delete" must be added.

    Closes-bug: #1533687
    Change-Id: Id414cf20069563085737fee5ddce94b1bf2f912d

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/274320

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/liberty)

Reviewed: https://review.openstack.org/274320
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=8476f6f949a8a4d50e14182f506509247873e507
Submitter: Jenkins
Branch: stable/liberty

commit 8476f6f949a8a4d50e14182f506509247873e507
Author: Sergey Belous <email address hidden>
Date: Mon Jan 18 16:37:06 2016 +0300

    Add relationship between port and floating ip

    We need to have the relationship between port and floating ip, because updating
    quota will happen when the event "after_delete" occurs. And current cascade
    removal of the floating ip does not cause the event "after_delete" for floating
    ip. The cascade on the ORM-level "delete" must be added.

    Closes-bug: #1533687
    Change-Id: Id414cf20069563085737fee5ddce94b1bf2f912d
    (cherry picked from commit c82f0021d50a19861da12e112fb8756d49d1b804)

tags: added: in-stable-liberty
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.