Better quota enforcement for GBP resources

This patch aligns the quota enforcement in GBP with the
changes made in Neutron quota management as a part of the
following blueprint and implementation patches referenced
therein:
https://blueprints.launchpad.net/neutron/+spec/better-quotas

The decorator @resource_registry.tracked_resources  in the
neutron.quota.resource_registry module is applied to the GBP
and Service Chain plugin __init__ methods.

In addition, the local_api module is also enhanced to enforce
quotas when GBP and Service Chain resources are created implicitly.

Older UTs that test the quotas have been preserved thus validating
the approach (they have only been moved to the appropriate test classes
on account of the resource tracking logic having moved from the earlier
DB modules to the plugin modules).

Closes-bug: 1594215

Change-Id: I38093426c89d1f4398c40da1f3392c0988831ff8
This commit is contained in:
Sumit Naiksatam
2016-06-19 01:43:56 -07:00
parent cc6141a1b2
commit 9519193d9c
12 changed files with 178 additions and 216 deletions

View File

@@ -13,6 +13,7 @@
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.plugins.common import constants as pconst
from neutron.quota import resource_registry
from oslo_config import cfg
from oslo_log import helpers as log
from oslo_log import log as logging
@@ -43,6 +44,11 @@ class NodeCompositionPlugin(servicechain_db.ServiceChainDbPlugin,
supported_extension_aliases = ["servicechain"]
path_prefix = gp_cts.GBP_PREFIXES[pconst.SERVICECHAIN]
@resource_registry.tracked_resources(
servicechain_node=servicechain_db.ServiceChainNode,
servicechain_spec=servicechain_db.ServiceChainSpec,
servicechain_instance=servicechain_db.ServiceChainInstance,
service_profile=servicechain_db.ServiceProfile)
def __init__(self):
self.driver_manager = manager.NodeDriverManager()
super(NodeCompositionPlugin, self).__init__()