]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Introduce usage data tracking for Neutron
authorSalvatore Orlando <salv.orlando@gmail.com>
Thu, 16 Apr 2015 18:56:27 +0000 (11:56 -0700)
committerSalvatore Orlando <salv.orlando@gmail.com>
Tue, 28 Jul 2015 18:55:03 +0000 (11:55 -0700)
commit3c584084c3c79489a7c81b323df5a15b44011e9f
tree72cd01c8eae84f5da6c7d2ef77a7217b0245d402
parent1663f5c19756fee984f0aeea9befc3a823387c8e
Introduce usage data tracking for Neutron

This patch introduces application logic support for tracking
Neutron resource usage data, thus introducing a different
way of enforcing quota limits, which now relies on records
tracking resource usage for each tenant.

When these records go "out-of-sync" with actual resource usage,
the quota usage table entry is marked "dirty".
And it will be resynchronized the next time a resource count is
requested. Changes in resource utilization are detected using
SQLAlchemy events.

This patch however does not automatically enable resource usage
tracking for any plugin. Plugins must explicitly declare for which
resources they wish to enable tracking. To this aim, this patch
provides the @tracked_resources decorator.

As some operators might wish to not use resource usage tracking, this
patch adds the track_quota_usage configuration option. If set to
False, DB-level usage tracking will not be performed, and
resources will be counted as before, ie: invoking a plugin method.

Usage tracking is performed using a new resource type,
TrackedResource, which can work side by side with CountableResource,
the one Neutron used so far. To this aim a ResourceRegistry class
has been introduced for registering and managing resources. Most
of the resource management code previously embedded in the
QuotaEngine class is being moved to ResourceRegistry as a part of
this patch.

Partially implements blueprint better-quota

Change-Id: If461399900973a38d7b82e0b3ac54fc052f09529
18 files changed:
neutron/api/rpc/handlers/dhcp_rpc.py
neutron/api/v2/base.py
neutron/api/v2/resource_helper.py
neutron/api/v2/router.py
neutron/db/ipam_backend_mixin.py
neutron/db/models_v2.py
neutron/extensions/quotasv2.py
neutron/extensions/securitygroup.py
neutron/plugins/nec/extensions/packetfilter.py
neutron/quota/__init__.py
neutron/quota/resource.py [new file with mode: 0644]
neutron/quota/resource_registry.py [new file with mode: 0644]
neutron/tests/unit/api/v2/test_base.py
neutron/tests/unit/extensions/extensionattribute.py
neutron/tests/unit/extensions/test_quotasv2.py
neutron/tests/unit/quota/__init__.py [new file with mode: 0644]
neutron/tests/unit/quota/test_resource.py [new file with mode: 0644]
neutron/tests/unit/quota/test_resource_registry.py [new file with mode: 0644]