Reference QUOTA OptGoup names in lowercase
To have consistent option group name format across projects, oslo.config now normalizes all non lowercase group names to lowercase when loading conf files. Thus conf files are backwards compatible but option group references in the code must now use lowercase before we update oslo.config. This patch replaces all 'QUOTA' references to 'quota' Change-Id: I74c2a35aea7a52f9586eb598fe52d2cecb1851ef
This commit is contained in:
parent
240ba2d007
commit
362bd7fd09
|
@ -258,7 +258,7 @@ notification_topics = notifications
|
|||
#ssl_ca_file = /path/to/cafile
|
||||
# ======== end of WSGI parameters related to the API server ==========
|
||||
|
||||
[QUOTAS]
|
||||
[quotas]
|
||||
# resource name(s) that are supported in quota features
|
||||
# quota_items = network,subnet,port
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ sql_connection = sqlite://
|
|||
# sql_idle_timeout = 3600
|
||||
|
||||
|
||||
[QUOTAS]
|
||||
[quotas]
|
||||
# number of network gateways allowed per tenant, -1 means unlimited
|
||||
# quota_network_gateway = 5
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ _db_opts = [
|
|||
CONF = cfg.ConfigOpts()
|
||||
CONF.register_opts(_core_opts)
|
||||
CONF.register_opts(_db_opts, 'DATABASE')
|
||||
CONF.register_opts(_quota_opts, 'QUOTAS')
|
||||
CONF.register_opts(_quota_opts, 'quotas')
|
||||
|
||||
|
||||
def do_alembic_command(config, cmd, *args, **kwargs):
|
||||
|
|
|
@ -159,7 +159,7 @@ l3_quota_opts = [
|
|||
help=_('Number of floating IPs allowed per tenant, '
|
||||
'-1 for unlimited')),
|
||||
]
|
||||
cfg.CONF.register_opts(l3_quota_opts, 'QUOTAS')
|
||||
cfg.CONF.register_opts(l3_quota_opts, 'quotas')
|
||||
|
||||
|
||||
class L3(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -43,7 +43,7 @@ class QuotaSetsController(wsgi.Controller):
|
|||
def __init__(self, plugin):
|
||||
self._resource_name = RESOURCE_NAME
|
||||
self._plugin = plugin
|
||||
self._driver = importutils.import_class(cfg.CONF.QUOTAS.quota_driver)
|
||||
self._driver = importutils.import_class(cfg.CONF.quotas.quota_driver)
|
||||
self._update_extended_attributes = True
|
||||
|
||||
def _update_attributes(self):
|
||||
|
@ -117,7 +117,7 @@ class Quotasv2(extensions.ExtensionDescriptor):
|
|||
@classmethod
|
||||
def get_description(cls):
|
||||
description = 'Expose functions for quotas management'
|
||||
if cfg.CONF.QUOTAS.quota_driver == DB_QUOTA_DRIVER:
|
||||
if cfg.CONF.quotas.quota_driver == DB_QUOTA_DRIVER:
|
||||
description += ' per tenant'
|
||||
return description
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ security_group_quota_opts = [
|
|||
help=_('Number of security rules allowed per tenant, '
|
||||
'-1 for unlimited')),
|
||||
]
|
||||
cfg.CONF.register_opts(security_group_quota_opts, 'QUOTAS')
|
||||
cfg.CONF.register_opts(security_group_quota_opts, 'quotas')
|
||||
|
||||
|
||||
class Securitygroup(extensions.ExtensionDescriptor):
|
||||
|
|
|
@ -22,7 +22,7 @@ core_plugin = quantum.plugins.cisco.network_plugin.PluginV2
|
|||
# The messaging module to use, defaults to kombu.
|
||||
rpc_backend = quantum.openstack.common.rpc.impl_fake
|
||||
|
||||
[QUOTAS]
|
||||
[quotas]
|
||||
# resource name(s) that are supported in quota features
|
||||
quota_items = network,subnet,port
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ quota_packet_filter_opts = [
|
|||
"-1 for unlimited"))
|
||||
]
|
||||
# Register the configuration options
|
||||
cfg.CONF.register_opts(quota_packet_filter_opts, 'QUOTAS')
|
||||
cfg.CONF.register_opts(quota_packet_filter_opts, 'quotas')
|
||||
|
||||
|
||||
PACKET_FILTER_ACTION_REGEX = "(?i)^(allow|accept|drop|deny)$"
|
||||
|
|
|
@ -89,7 +89,7 @@ nw_gw_quota_opts = [
|
|||
'-1 for unlimited'))
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(nw_gw_quota_opts, 'QUOTAS')
|
||||
cfg.CONF.register_opts(nw_gw_quota_opts, 'quotas')
|
||||
|
||||
attributes.validators['type:device_list'] = _validate_device_list
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ quota_opts = [
|
|||
help=_('Default driver to use for quota checks')),
|
||||
]
|
||||
# Register the configuration options
|
||||
cfg.CONF.register_opts(quota_opts, 'QUOTAS')
|
||||
cfg.CONF.register_opts(quota_opts, 'quotas')
|
||||
|
||||
|
||||
class ConfDriver(object):
|
||||
|
@ -163,9 +163,9 @@ class BaseResource(object):
|
|||
@property
|
||||
def default(self):
|
||||
"""Return the default value of the quota."""
|
||||
return getattr(cfg.CONF.QUOTAS,
|
||||
return getattr(cfg.CONF.quotas,
|
||||
self.flag,
|
||||
cfg.CONF.QUOTAS.default_quota)
|
||||
cfg.CONF.quotas.default_quota)
|
||||
|
||||
|
||||
class CountableResource(BaseResource):
|
||||
|
@ -206,7 +206,7 @@ class QuotaEngine(object):
|
|||
"""Initialize a Quota object."""
|
||||
|
||||
if not quota_driver_class:
|
||||
quota_driver_class = cfg.CONF.QUOTAS.quota_driver
|
||||
quota_driver_class = cfg.CONF.quotas.quota_driver
|
||||
|
||||
if isinstance(quota_driver_class, basestring):
|
||||
quota_driver_class = importutils.import_object(quota_driver_class)
|
||||
|
@ -306,7 +306,7 @@ def _count_resource(context, plugin, resources, tenant_id):
|
|||
|
||||
def register_resources_from_config():
|
||||
resources = []
|
||||
for resource_item in cfg.CONF.QUOTAS.quota_items:
|
||||
for resource_item in cfg.CONF.quotas.quota_items:
|
||||
resources.append(CountableResource(resource_item, _count_resource,
|
||||
'quota_' + resource_item))
|
||||
QUOTAS.register_resources(resources)
|
||||
|
|
|
@ -1299,7 +1299,7 @@ class NotificationTest(APIv2TestBase):
|
|||
|
||||
class QuotaTest(APIv2TestBase):
|
||||
def test_create_network_quota(self):
|
||||
cfg.CONF.set_override('quota_network', 1, group='QUOTAS')
|
||||
cfg.CONF.set_override('quota_network', 1, group='quotas')
|
||||
initial_input = {'network': {'name': 'net1', 'tenant_id': _uuid()}}
|
||||
full_input = {'network': {'admin_state_up': True, 'subnets': []}}
|
||||
full_input['network'].update(initial_input['network'])
|
||||
|
@ -1314,7 +1314,7 @@ class QuotaTest(APIv2TestBase):
|
|||
res.json['QuantumError'])
|
||||
|
||||
def test_create_network_quota_no_counts(self):
|
||||
cfg.CONF.set_override('quota_network', 1, group='QUOTAS')
|
||||
cfg.CONF.set_override('quota_network', 1, group='quotas')
|
||||
initial_input = {'network': {'name': 'net1', 'tenant_id': _uuid()}}
|
||||
full_input = {'network': {'admin_state_up': True, 'subnets': []}}
|
||||
full_input['network'].update(initial_input['network'])
|
||||
|
@ -1331,7 +1331,7 @@ class QuotaTest(APIv2TestBase):
|
|||
res.json['QuantumError'])
|
||||
|
||||
def test_create_network_quota_without_limit(self):
|
||||
cfg.CONF.set_override('quota_network', -1, group='QUOTAS')
|
||||
cfg.CONF.set_override('quota_network', -1, group='quotas')
|
||||
initial_input = {'network': {'name': 'net1', 'tenant_id': _uuid()}}
|
||||
instance = self.plugin.return_value
|
||||
instance.get_networks_count.return_value = 3
|
||||
|
|
|
@ -1949,7 +1949,7 @@ class TestNetworksV2(QuantumDbPluginV2TestCase):
|
|||
if self._skip_native_bulk:
|
||||
self.skipTest("Plugin does not support native bulk network create")
|
||||
quota = 4
|
||||
cfg.CONF.set_override('quota_network', quota, group='QUOTAS')
|
||||
cfg.CONF.set_override('quota_network', quota, group='quotas')
|
||||
res = self._create_network_bulk(self.fmt, quota + 1, 'test', True)
|
||||
self._validate_behavior_on_bulk_failure(res, 'networks', errcode=409)
|
||||
|
||||
|
@ -1957,7 +1957,7 @@ class TestNetworksV2(QuantumDbPluginV2TestCase):
|
|||
if self._skip_native_bulk:
|
||||
self.skipTest("Plugin does not support native bulk network create")
|
||||
quota = 2
|
||||
cfg.CONF.set_override('quota_network', quota, group='QUOTAS')
|
||||
cfg.CONF.set_override('quota_network', quota, group='quotas')
|
||||
networks = [{'network': {'name': 'n1',
|
||||
'tenant_id': self._tenant_id}},
|
||||
{'network': {'name': 'n2',
|
||||
|
@ -1974,7 +1974,7 @@ class TestNetworksV2(QuantumDbPluginV2TestCase):
|
|||
if self._skip_native_bulk:
|
||||
self.skipTest("Plugin does not support native bulk network create")
|
||||
quota = 2
|
||||
cfg.CONF.set_override('quota_network', quota, group='QUOTAS')
|
||||
cfg.CONF.set_override('quota_network', quota, group='quotas')
|
||||
networks = [{'network': {'name': 'n1',
|
||||
'tenant_id': self._tenant_id}},
|
||||
{'network': {'name': 'n2',
|
||||
|
|
|
@ -48,7 +48,7 @@ class QuotaExtensionTestCase(testlib_api.WebTestCase):
|
|||
cfg.CONF.set_override(
|
||||
'quota_items',
|
||||
['network', 'subnet', 'port', 'extra1'],
|
||||
group='QUOTAS')
|
||||
group='quotas')
|
||||
quota.QUOTAS = quota.QuotaEngine()
|
||||
quota.register_resources_from_config()
|
||||
self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
|
||||
|
@ -83,7 +83,7 @@ class QuotaExtensionDbTestCase(QuotaExtensionTestCase):
|
|||
cfg.CONF.set_override(
|
||||
'quota_driver',
|
||||
'quantum.db.quota_db.DbQuotaDriver',
|
||||
group='QUOTAS')
|
||||
group='quotas')
|
||||
super(QuotaExtensionDbTestCase, self).setUp()
|
||||
|
||||
def test_quotas_loaded_right(self):
|
||||
|
|
|
@ -169,7 +169,7 @@ class RouterServiceInsertionTestCase(base.BaseTestCase):
|
|||
#just stubbing core plugin with LoadBalancer plugin
|
||||
cfg.CONF.set_override('core_plugin', plugin)
|
||||
cfg.CONF.set_override('service_plugins', [])
|
||||
cfg.CONF.set_override('quota_router', -1, group='QUOTAS')
|
||||
cfg.CONF.set_override('quota_router', -1, group='quotas')
|
||||
self.addCleanup(cfg.CONF.reset)
|
||||
|
||||
# Ensure 'stale' patched copies of the plugin are never returned
|
||||
|
|
Loading…
Reference in New Issue