]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Reference QUOTA OptGoup names in lowercase
authorZhongyue Luo <zhongyue.nah@intel.com>
Wed, 15 May 2013 00:36:11 +0000 (08:36 +0800)
committerGerrit Code Review <review@openstack.org>
Fri, 17 May 2013 00:02:31 +0000 (00:02 +0000)
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

14 files changed:
etc/quantum.conf
etc/quantum/plugins/nicira/nvp.ini
quantum/db/migration/cli.py
quantum/extensions/l3.py
quantum/extensions/quotasv2.py
quantum/extensions/securitygroup.py
quantum/plugins/cisco/tests/unit/v2/quantumv2.conf.cisco.test
quantum/plugins/nec/extensions/packetfilter.py
quantum/plugins/nicira/extensions/nvp_networkgw.py
quantum/quota.py
quantum/tests/unit/test_api_v2.py
quantum/tests/unit/test_db_plugin.py
quantum/tests/unit/test_quota_ext.py
quantum/tests/unit/test_routerserviceinsertion.py

index 095d1e9d4a25648fbcc562cf05a70e3838759c53..ddccd728700d1cda3dfceb945dcda9f3da60891d 100644 (file)
@@ -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
 
index e46dc195e8bef1d09f05479864f63fab2904624e..9eeaf3767a345751e077757f61c3104ddb7aa9bf 100644 (file)
@@ -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
 
index 8a033115be4fe4f36995ffcc2dc591b7b091d5a5..cc9932163deac1e51f6d45cac78ccf24d07c3faf 100644 (file)
@@ -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):
index 99691b1bf327f3c718ac641ba7893775a4a1b96d..ba5285318eb516c37c6654bff8173bae16ffdb94 100644 (file)
@@ -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):
index d49ffd3c4b148e4b053121ef3bbd72e9da3cb95a..6ae86062ceea83f67ab8eb29702f965f41f8e06a 100644 (file)
@@ -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
 
index 04adb37e53ae9670dca76e191f7d2ecf4d308081..825f03bf03406be8a5166abc4ba8b5a178d06f72 100644 (file)
@@ -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):
index dc855a7cc06cbb8f1d92558f34bbf0c944bbc7ad..742d482c0ce66e68cc2bd96aede532d2db09db8e 100644 (file)
@@ -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
 
index fe3bb6f92a1a886cfc439441df59e4c00519907c..944050562c4a30ec10bf43f9cc63b3074e06cd82 100644 (file)
@@ -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)$"
index 0bed36a11663eed9fc18701b2251266cbe45fa09..29fb9e7f25163bf23a77a22faa237d5564297b39 100644 (file)
@@ -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
 
index 3d229eaffb9538f0e5e7a42e32bc9d39f0a64bbe..e02fee6980f688921fc8b29e750cc5c334f1fe3c 100644 (file)
@@ -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)
index b5c250317188af036715843ce3d74afb46e66358..3398ba867c005ac68870950884b2d267c6aab166 100644 (file)
@@ -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
index 2b7269a7c1d92e7719f9e544aa5ad6c8267a6719..90d2260720371461e68dc5fc4487ab306494fcf3 100644 (file)
@@ -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',
index 73cfc74f97d34496251841813d43d2c2fbd21b9d..9035986a04ba25206b9b0383ce2077597ff4accb 100644 (file)
@@ -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):
index f7494ae282ba8b8b000f8a5df09307eb616d9636..f4866d6564e8bfcb1c25b97c54e1d0d29d50d9bf 100644 (file)
@@ -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