]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Use DB count to get resource counts.
authorJuergen Brendel <jbrendel@cisco.com>
Thu, 8 Nov 2012 02:00:11 +0000 (15:00 +1300)
committerJuergen Brendel <jbrendel@cisco.com>
Fri, 16 Nov 2012 19:16:54 +0000 (08:16 +1300)
commit513307fa916c5461bb9a144b74b562b9d34a1c65
tree35fbc9f405837173d10e722428255e129d92f606
parentddeeee817229ba2e3b6e1abd8fb2bb8566e63177
Use DB count to get resource counts.

Fixes bug 1075369.

During quota check we used to simply retrieve the entire collection
of resources from the database, then counting them in Python. This
patch introduces a specialized _get_collection_count() method, which
instead take advantage of the DB's built-in count capabilities.

In order to take advantage of this, plugins can now implement
get_*_count() methods for their resources. This is used (if present)
by the quota checking function.

Patch incorporates review feedback from Dan W, Alex Xu, Zhongyue Luo,
Edgar Magana, Akihiro Motoki and gongysh.

Change-Id: I87e2d0294e116e8147fed2ee90c9eb0cf1a54362
quantum/db/db_base_plugin_v2.py
quantum/db/l3_db.py
quantum/db/securitygroups_db.py
quantum/plugins/cisco/models/virt_phy_sw_v2.py
quantum/plugins/cisco/network_plugin.py
quantum/quantum_plugin_base_v2.py
quantum/quota.py
quantum/tests/unit/test_api_v2.py
quantum/tests/unit/test_db_plugin.py