From ebd23c945d14c7d13f9c1c95bf966b26b7ca203e Mon Sep 17 00:00:00 2001 From: Chris Yeoh Date: Wed, 20 Nov 2013 22:18:43 +1030 Subject: [PATCH] Hide injected_file related quotas for V3 API The injected_files, injected_file_content_bytes and injected_file_path_bytes are all related to the os-personalities extension which has been removed. They can't be removed from the core quotas code as that has to still support the V2 API. So for the V3 API we just hide them. DocImpact Partially implements blueprint v3-api-remove-extensions Change-Id: Iedb6e1427ac22f1926e929f3391e56403c37d088 --- .../quota-classes-show-get-resp.json | 5 +-- .../quota-classes-show-get-resp.xml | 5 +-- .../quota-classes-update-post-req.json | 5 +-- .../quota-classes-update-post-req.xml | 5 +-- .../quota-classes-update-post-resp.json | 5 +-- .../quota-classes-update-post-resp.xml | 5 +-- .../quotas-show-defaults-get-resp.json | 5 +-- .../quotas-show-defaults-get-resp.xml | 5 +-- .../os-quota-sets/quotas-show-get-resp.json | 5 +-- .../os-quota-sets/quotas-show-get-resp.xml | 5 +-- .../quotas-update-force-post-resp.json | 5 +-- .../quotas-update-force-post-resp.xml | 5 +-- .../quotas-update-post-resp.json | 5 +-- .../os-quota-sets/quotas-update-post-resp.xml | 5 +-- .../user-quotas-show-get-resp.json | 5 +-- .../user-quotas-show-get-resp.xml | 5 +-- .../user-quotas-update-post-resp.json | 5 +-- .../user-quotas-update-post-resp.xml | 5 +-- .../compute/plugins/v3/quota_classes.py | 13 ++++--- .../compute/plugins/v3/quota_sets.py | 28 +++++++++----- .../compute/plugins/v3/test_quota_classes.py | 26 ++----------- .../compute/plugins/v3/test_quota_sets.py | 37 ++++++------------- .../quota-classes-show-get-resp.json.tpl | 3 -- .../quota-classes-show-get-resp.xml.tpl | 3 -- .../quota-classes-update-post-req.json.tpl | 3 -- .../quota-classes-update-post-req.xml.tpl | 3 -- .../quota-classes-update-post-resp.json.tpl | 3 -- .../quota-classes-update-post-resp.xml.tpl | 3 -- .../quotas-show-defaults-get-resp.json.tpl | 3 -- .../quotas-show-defaults-get-resp.xml.tpl | 3 -- .../quotas-show-get-resp.json.tpl | 3 -- .../quotas-show-get-resp.xml.tpl | 3 -- .../quotas-update-force-post-resp.json.tpl | 5 +-- .../quotas-update-force-post-resp.xml.tpl | 5 +-- .../quotas-update-post-resp.json.tpl | 3 -- .../quotas-update-post-resp.xml.tpl | 3 -- .../user-quotas-show-get-resp.json.tpl | 3 -- .../user-quotas-show-get-resp.xml.tpl | 3 -- .../user-quotas-update-post-resp.json.tpl | 3 -- .../user-quotas-update-post-resp.xml.tpl | 3 -- 40 files changed, 61 insertions(+), 191 deletions(-) diff --git a/doc/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json b/doc/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json index 462425c8f0d5..f7f01611c435 100644 --- a/doc/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json +++ b/doc/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json @@ -4,9 +4,6 @@ "fixed_ips": -1, "floating_ips": 10, "id": "test_class", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, @@ -14,4 +11,4 @@ "security_group_rules": 20, "security_groups": 10 } -} \ No newline at end of file +} diff --git a/doc/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml b/doc/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml index d0570e9c8556..1840e7c7e4d0 100644 --- a/doc/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml +++ b/doc/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml @@ -3,13 +3,10 @@ 20 -1 10 - 10240 - 255 - 5 10 100 128 51200 20 10 - \ No newline at end of file + diff --git a/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.json b/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.json index 4f6f840f1bc9..4858f1bf5db9 100644 --- a/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.json +++ b/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.json @@ -6,11 +6,8 @@ "floating_ips": 10, "fixed_ips": -1, "metadata_items": 128, - "injected_files": 5, - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, "security_groups": 10, "security_group_rules": 20, "key_pairs": 100 } -} \ No newline at end of file +} diff --git a/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml b/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml index d55c98017221..89b9b76294f8 100644 --- a/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml +++ b/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml @@ -3,13 +3,10 @@ 50 10 -1 - 10240 - 255 - 5 50 100 128 51200 20 10 - \ No newline at end of file + diff --git a/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json b/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json index 41ebc43f4a9a..a271766ca99f 100644 --- a/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json +++ b/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json @@ -4,9 +4,6 @@ "fixed_ips": -1, "floating_ips": 10, "id": "test_class", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 50, "key_pairs": 100, "metadata_items": 128, @@ -14,4 +11,4 @@ "security_group_rules": 20, "security_groups": 10 } -} \ No newline at end of file +} diff --git a/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml b/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml index 045317f29cea..bf17b492cbe2 100644 --- a/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml +++ b/doc/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml @@ -3,13 +3,10 @@ 50 -1 10 - 10240 - 255 - 5 50 100 128 51200 20 10 - \ No newline at end of file + diff --git a/doc/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json b/doc/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json index 0f540754566c..6b77169cb61f 100644 --- a/doc/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json +++ b/doc/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json @@ -4,9 +4,6 @@ "fixed_ips": -1, "floating_ips": 10, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, @@ -14,4 +11,4 @@ "security_group_rules": 20, "security_groups": 10 } -} \ No newline at end of file +} diff --git a/doc/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml b/doc/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml index da9a2577e225..9ae64f3a7110 100644 --- a/doc/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml +++ b/doc/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml @@ -3,13 +3,10 @@ 20 -1 10 - 10240 - 255 - 5 10 100 128 51200 20 10 - \ No newline at end of file + diff --git a/doc/v3/api_samples/os-quota-sets/quotas-show-get-resp.json b/doc/v3/api_samples/os-quota-sets/quotas-show-get-resp.json index 0f540754566c..6b77169cb61f 100644 --- a/doc/v3/api_samples/os-quota-sets/quotas-show-get-resp.json +++ b/doc/v3/api_samples/os-quota-sets/quotas-show-get-resp.json @@ -4,9 +4,6 @@ "fixed_ips": -1, "floating_ips": 10, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, @@ -14,4 +11,4 @@ "security_group_rules": 20, "security_groups": 10 } -} \ No newline at end of file +} diff --git a/doc/v3/api_samples/os-quota-sets/quotas-show-get-resp.xml b/doc/v3/api_samples/os-quota-sets/quotas-show-get-resp.xml index da9a2577e225..9ae64f3a7110 100644 --- a/doc/v3/api_samples/os-quota-sets/quotas-show-get-resp.xml +++ b/doc/v3/api_samples/os-quota-sets/quotas-show-get-resp.xml @@ -3,13 +3,10 @@ 20 -1 10 - 10240 - 255 - 5 10 100 128 51200 20 10 - \ No newline at end of file + diff --git a/doc/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json b/doc/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json index 8f98181fd79f..d32069728056 100644 --- a/doc/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json +++ b/doc/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json @@ -4,9 +4,6 @@ "fixed_ips": -1, "floating_ips": 10, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 45, "key_pairs": 100, "metadata_items": 128, @@ -14,4 +11,4 @@ "security_group_rules": 20, "security_groups": 10 } -} \ No newline at end of file +} diff --git a/doc/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.xml b/doc/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.xml index 8d881801830f..f679ccb0b41c 100644 --- a/doc/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.xml +++ b/doc/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.xml @@ -3,13 +3,10 @@ 20 -1 10 - 10240 - 255 - 5 45 100 128 51200 20 10 - \ No newline at end of file + diff --git a/doc/v3/api_samples/os-quota-sets/quotas-update-post-resp.json b/doc/v3/api_samples/os-quota-sets/quotas-update-post-resp.json index ae2bda094154..fea381f06e84 100644 --- a/doc/v3/api_samples/os-quota-sets/quotas-update-post-resp.json +++ b/doc/v3/api_samples/os-quota-sets/quotas-update-post-resp.json @@ -4,9 +4,6 @@ "fixed_ips": -1, "floating_ips": 10, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, @@ -14,4 +11,4 @@ "security_group_rules": 20, "security_groups": 45 } -} \ No newline at end of file +} diff --git a/doc/v3/api_samples/os-quota-sets/quotas-update-post-resp.xml b/doc/v3/api_samples/os-quota-sets/quotas-update-post-resp.xml index a97431e00afd..9183771b0c77 100644 --- a/doc/v3/api_samples/os-quota-sets/quotas-update-post-resp.xml +++ b/doc/v3/api_samples/os-quota-sets/quotas-update-post-resp.xml @@ -3,13 +3,10 @@ 20 -1 10 - 10240 - 255 - 5 10 100 128 51200 20 45 - \ No newline at end of file + diff --git a/doc/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json b/doc/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json index 0f540754566c..6b77169cb61f 100644 --- a/doc/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json +++ b/doc/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json @@ -4,9 +4,6 @@ "fixed_ips": -1, "floating_ips": 10, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, @@ -14,4 +11,4 @@ "security_group_rules": 20, "security_groups": 10 } -} \ No newline at end of file +} diff --git a/doc/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.xml b/doc/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.xml index da9a2577e225..9ae64f3a7110 100644 --- a/doc/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.xml +++ b/doc/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.xml @@ -3,13 +3,10 @@ 20 -1 10 - 10240 - 255 - 5 10 100 128 51200 20 10 - \ No newline at end of file + diff --git a/doc/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json b/doc/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json index 4a3fb5dd58d6..28ffee80e9b5 100644 --- a/doc/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json +++ b/doc/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json @@ -4,9 +4,6 @@ "fixed_ips": -1, "floating_ips": 10, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 9, "key_pairs": 100, "metadata_items": 128, @@ -14,4 +11,4 @@ "security_group_rules": 20, "security_groups": 10 } -} \ No newline at end of file +} diff --git a/doc/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.xml b/doc/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.xml index dac476212326..c475769d7068 100644 --- a/doc/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.xml +++ b/doc/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.xml @@ -3,13 +3,10 @@ 20 -1 10 - 10240 - 255 - 5 9 100 128 51200 20 10 - \ No newline at end of file + diff --git a/nova/api/openstack/compute/plugins/v3/quota_classes.py b/nova/api/openstack/compute/plugins/v3/quota_classes.py index 8bea391fdf63..877f88945999 100644 --- a/nova/api/openstack/compute/plugins/v3/quota_classes.py +++ b/nova/api/openstack/compute/plugins/v3/quota_classes.py @@ -26,7 +26,8 @@ from nova import quota QUOTAS = quota.QUOTAS - +FILTERED_QUOTAS = ['injected_files', 'injected_file_content_bytes', + 'injected_file_path_bytes'] ALIAS = "os-quota-class-sets" authorize = extensions.extension_authorizer('compute', 'v3:' + ALIAS) @@ -38,8 +39,9 @@ class QuotaClassTemplate(xmlutil.TemplateBuilder): root.set('id') for resource in QUOTAS.resources: - elem = xmlutil.SubTemplateElement(root, resource) - elem.text = resource + if resource not in FILTERED_QUOTAS: + elem = xmlutil.SubTemplateElement(root, resource) + elem.text = resource return xmlutil.MasterTemplate(root, 1) @@ -52,7 +54,8 @@ class QuotaClassSetsController(wsgi.Controller): result = dict(id=str(quota_class)) for resource in QUOTAS.resources: - result[resource] = quota_set[resource] + if resource not in FILTERED_QUOTAS: + result[resource] = quota_set[resource] return dict(quota_class_set=result) @@ -78,7 +81,7 @@ class QuotaClassSetsController(wsgi.Controller): raise webob.exc.HTTPBadRequest("The request body invalid") quota_class_set = body['quota_class_set'] for key in quota_class_set.keys(): - if key in QUOTAS: + if key in QUOTAS and key not in FILTERED_QUOTAS: try: value = int(quota_class_set[key]) except ValueError: diff --git a/nova/api/openstack/compute/plugins/v3/quota_sets.py b/nova/api/openstack/compute/plugins/v3/quota_sets.py index afeeebd57627..9f6b5625fbd0 100644 --- a/nova/api/openstack/compute/plugins/v3/quota_sets.py +++ b/nova/api/openstack/compute/plugins/v3/quota_sets.py @@ -33,6 +33,8 @@ from nova import quota ALIAS = "os-quota-sets" QUOTAS = quota.QUOTAS LOG = logging.getLogger(__name__) +FILTERED_QUOTAS = ['injected_files', 'injected_file_content_bytes', + 'injected_file_path_bytes'] authorize_update = extensions.extension_authorizer('compute', 'v3:%s:update' % ALIAS) authorize_show = extensions.extension_authorizer('compute', @@ -49,8 +51,9 @@ class QuotaTemplate(xmlutil.TemplateBuilder): root.set('id') for resource in QUOTAS.resources: - elem = xmlutil.SubTemplateElement(root, resource) - elem.text = resource + if resource not in FILTERED_QUOTAS: + elem = xmlutil.SubTemplateElement(root, resource) + elem.text = resource return xmlutil.MasterTemplate(root, 1) @@ -61,11 +64,12 @@ class QuotaDetailTemplate(xmlutil.TemplateBuilder): root.set('id') for resource in QUOTAS.resources: - elem = xmlutil.SubTemplateElement(root, resource, - selector=resource) - elem.set('in_use') - elem.set('reserved') - elem.set('limit') + if resource not in FILTERED_QUOTAS: + elem = xmlutil.SubTemplateElement(root, resource, + selector=resource) + elem.set('in_use') + elem.set('reserved') + elem.set('limit') return xmlutil.MasterTemplate(root, 1) @@ -96,6 +100,8 @@ class QuotaSetsController(wsgi.Controller): usages=usages) else: values = QUOTAS.get_project_quotas(context, id, usages=usages) + values = dict((k, v) for k, v in values.items() if k not in + FILTERED_QUOTAS) if usages: return values @@ -148,7 +154,8 @@ class QuotaSetsController(wsgi.Controller): quota_set = body['quota_set'] for key, value in quota_set.items(): - if key not in QUOTAS and key != 'force': + if ((key not in QUOTAS or key in FILTERED_QUOTAS) + and key != 'force'): bad_keys.append(key) continue if key == 'force': @@ -224,7 +231,10 @@ class QuotaSetsController(wsgi.Controller): def defaults(self, req, id): context = req.environ['nova.context'] authorize_show(context) - return self._format_quota_set(id, QUOTAS.get_defaults(context)) + values = QUOTAS.get_defaults(context) + values = dict((k, v) for k, v in values.items() if k not in + FILTERED_QUOTAS) + return self._format_quota_set(id, values) @extensions.expected_errors(403) @wsgi.response(204) diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_quota_classes.py b/nova/tests/api/openstack/compute/plugins/v3/test_quota_classes.py index 203e7c50afc1..b7d1a613cfcc 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_quota_classes.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_quota_classes.py @@ -26,11 +26,9 @@ def quota_set(class_name): return {'quota_class_set': {'id': class_name, 'metadata_items': 128, 'ram': 51200, 'floating_ips': 10, 'fixed_ips': -1, 'instances': 10, - 'injected_files': 5, 'cores': 20, - 'injected_file_content_bytes': 10240, + 'cores': 20, 'security_groups': 10, - 'security_group_rules': 20, 'key_pairs': 100, - 'injected_file_path_bytes': 255}} + 'security_group_rules': 20, 'key_pairs': 100}} class QuotaClassSetsTest(test.TestCase): @@ -47,9 +45,6 @@ class QuotaClassSetsTest(test.TestCase): 'floating_ips': 10, 'fixed_ips': -1, 'metadata_items': 128, - 'injected_files': 5, - 'injected_file_path_bytes': 255, - 'injected_file_content_bytes': 10240, 'security_groups': 10, 'security_group_rules': 20, 'key_pairs': 100, @@ -66,9 +61,6 @@ class QuotaClassSetsTest(test.TestCase): self.assertEqual(qs['floating_ips'], 10) self.assertEqual(qs['fixed_ips'], -1) self.assertEqual(qs['metadata_items'], 128) - self.assertEqual(qs['injected_files'], 5) - self.assertEqual(qs['injected_file_path_bytes'], 255) - self.assertEqual(qs['injected_file_content_bytes'], 10240) self.assertEqual(qs['security_groups'], 10) self.assertEqual(qs['security_group_rules'], 20) self.assertEqual(qs['key_pairs'], 100) @@ -89,9 +81,7 @@ class QuotaClassSetsTest(test.TestCase): body = {'quota_class_set': {'instances': 50, 'cores': 50, 'ram': 51200, 'floating_ips': 10, 'fixed_ips': -1, 'metadata_items': 128, - 'injected_files': 5, 'id': 'test_class', - 'injected_file_content_bytes': 10240, - 'injected_file_path_bytes': 255, + 'id': 'test_class', 'security_groups': 10, 'security_group_rules': 20, 'key_pairs': 100}} @@ -125,8 +115,6 @@ class QuotaClassSetsTest(test.TestCase): body = {'quota_class_set': {'instances': 50, 'cores': 50, 'ram': 51200, 'floating_ips': 10, 'fixed_ips': -1, 'metadata_items': 128, - 'injected_files': 5, - 'injected_file_content_bytes': 10240, 'security_groups': 10, 'security_group_rules': 20, 'key_pairs': 100, @@ -147,13 +135,10 @@ class QuotaTemplateXMLSerializerTest(test.TestCase): exemplar = dict(quota_class_set=dict( id='test_class', metadata_items=10, - injected_file_path_bytes=255, - injected_file_content_bytes=20, ram=50, floating_ips=60, fixed_ips=-1, instances=70, - injected_files=80, security_groups=10, security_group_rules=20, key_pairs=100, @@ -173,12 +158,10 @@ class QuotaTemplateXMLSerializerTest(test.TestCase): def test_deserializer(self): exemplar = dict(quota_class_set=dict( metadata_items='10', - injected_file_content_bytes='20', ram='50', floating_ips='60', fixed_ips='-1', instances='70', - injected_files='80', security_groups='10', security_group_rules='20', key_pairs='100', @@ -186,13 +169,10 @@ class QuotaTemplateXMLSerializerTest(test.TestCase): intext = ("\n" '' '10' - '20' - '' '50' '60' '-1' '70' - '80' '90' '10' '20' diff --git a/nova/tests/api/openstack/compute/plugins/v3/test_quota_sets.py b/nova/tests/api/openstack/compute/plugins/v3/test_quota_sets.py index 51a83c0444ca..b0cd682fd6b8 100644 --- a/nova/tests/api/openstack/compute/plugins/v3/test_quota_sets.py +++ b/nova/tests/api/openstack/compute/plugins/v3/test_quota_sets.py @@ -40,13 +40,10 @@ class QuotaSetsTest(test.TestCase): 'floating_ips': 10, 'fixed_ips': -1, 'instances': 10, - 'injected_files': 5, 'cores': 20, - 'injected_file_content_bytes': 10240, 'security_groups': 10, 'security_group_rules': 20, - 'key_pairs': 100, - 'injected_file_path_bytes': 255} + 'key_pairs': 100} } quota_set['quota_set'].update(kwargs) return quota_set @@ -57,16 +54,11 @@ class QuotaSetsTest(test.TestCase): {'cores': {'in_use': 0, 'limit': 20, 'reserved': 0}, 'fixed_ips': {'in_use': 0, 'limit': -1, 'reserved': 0}, 'floating_ips': {'in_use': 0, 'limit': 10, 'reserved': 0}, - 'injected_files': {'in_use': 0, 'limit': 5, 'reserved': 0}, 'instances': {'in_use': 0, 'limit': 10, 'reserved': 0}, 'key_pairs': {'in_use': 0, 'limit': 100, 'reserved': 0}, 'metadata_items': {'in_use': 0, 'limit': 128, 'reserved': 0}, 'ram': {'in_use': 0, 'limit': 51200, 'reserved': 0}, 'security_groups': {'in_use': 0, 'limit': 10, 'reserved': 0}, - 'injected_file_content_bytes': - {'in_use': 0, 'limit': 10240, 'reserved': 0}, - 'injected_file_path_bytes': - {'in_use': 0, 'limit': 255, 'reserved': 0}, 'security_group_rules': {'in_use': 0, 'limit': 20, 'reserved': 0}} } @@ -85,9 +77,6 @@ class QuotaSetsTest(test.TestCase): self.assertEqual(qs['floating_ips'], 10) self.assertEqual(qs['fixed_ips'], -1) self.assertEqual(qs['metadata_items'], 128) - self.assertEqual(qs['injected_files'], 5) - self.assertEqual(qs['injected_file_path_bytes'], 255) - self.assertEqual(qs['injected_file_content_bytes'], 10240) self.assertEqual(qs['security_groups'], 10) self.assertEqual(qs['security_group_rules'], 20) self.assertEqual(qs['key_pairs'], 100) @@ -140,9 +129,6 @@ class QuotaSetsTest(test.TestCase): body = {'quota_set': {'instances': 0, 'cores': 0, 'ram': 0, 'floating_ips': 0, 'fixed_ips': 0, 'metadata_items': 0, - 'injected_files': 0, - 'injected_file_content_bytes': 0, - 'injected_file_path_bytes': 0, 'security_groups': 0, 'security_group_rules': 0, 'key_pairs': 100, 'fixed_ips': -1}} @@ -170,6 +156,16 @@ class QuotaSetsTest(test.TestCase): self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update, req, 'update_me', body) + def test_quotas_update_filtered_key(self): + body = self._generate_quota_set() + body['quota_set'].pop('instances') + body['quota_set']['injected_files'] = 10 + + req = fakes.HTTPRequestV3.blank('/os-quota-sets/update_me', + use_admin_context=True) + self.assertRaises(webob.exc.HTTPBadRequest, self.controller.update, + req, 'update_me', body) + def test_quotas_update_invalid_limit(self): body = self._generate_quota_set(instances=-2) @@ -343,13 +339,10 @@ class QuotaXMLSerializerTest(test.TestCase): exemplar = dict(quota_set=dict( id='project_id', metadata_items=10, - injected_file_path_bytes=255, - injected_file_content_bytes=20, ram=50, floating_ips=60, fixed_ips=-1, instances=70, - injected_files=80, security_groups=10, security_group_rules=20, key_pairs=100, @@ -369,13 +362,10 @@ class QuotaXMLSerializerTest(test.TestCase): exemplar = dict(quota_set=dict( id='project_id', metadata_items=dict(limit=10, in_use=1, reserved=2), - injected_file_path_bytes=dict(limit=255, in_use=25, reserved=1), - injected_file_content_bytes=dict(limit=20, in_use=10, reserved=2), ram=dict(limit=30, in_use=10, reserved=3), floating_ips=dict(limit=60, in_use=20, reserved=20), fixed_ips=dict(limit=-1, in_use=20, reserved=0), instances=dict(limit=10, in_use=2, reserved=2), - injected_files=dict(limit=80, in_use=20, reserved=30), security_groups=dict(limit=10, in_use=4, reserved=6), security_group_rules=dict(limit=20, in_use=10, reserved=8), key_pairs=dict(limit=20, in_use=10, reserved=11), @@ -397,12 +387,10 @@ class QuotaXMLSerializerTest(test.TestCase): def test_deserializer(self): exemplar = dict(quota_set=dict( metadata_items='10', - injected_file_content_bytes='20', ram='50', floating_ips='60', fixed_ips='-1', instances='70', - injected_files='80', security_groups='10', security_group_rules='20', key_pairs='100', @@ -410,13 +398,10 @@ class QuotaXMLSerializerTest(test.TestCase): intext = ("\n" '' '10' - '20' - '' '50' '60' '-1' '70' - '80' '10' '20' '100' diff --git a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl index f9a94e760af7..411ede27f2d8 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.json.tpl @@ -4,9 +4,6 @@ "floating_ips": 10, "fixed_ips": -1, "id": "%(set_id)s", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, diff --git a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl index fb8e7992a510..91aad7f55eb5 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-show-get-resp.xml.tpl @@ -3,9 +3,6 @@ 20 10 -1 - 10240 - 255 - 5 10 100 128 diff --git a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl index 483fda8c53e7..4858f1bf5db9 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.json.tpl @@ -6,9 +6,6 @@ "floating_ips": 10, "fixed_ips": -1, "metadata_items": 128, - "injected_files": 5, - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, "security_groups": 10, "security_group_rules": 20, "key_pairs": 100 diff --git a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl index 150fb6a42a7c..89b9b76294f8 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-req.xml.tpl @@ -3,9 +3,6 @@ 50 10 -1 - 10240 - 255 - 5 50 100 128 diff --git a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl index a23f7794b8dd..55c37aced490 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.json.tpl @@ -3,9 +3,6 @@ "cores": 50, "floating_ips": 10, "fixed_ips": -1, - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 50, "key_pairs": 100, "metadata_items": 128, diff --git a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl index 6bb5911a8550..6e9532199d23 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-class-sets/quota-classes-update-post-resp.xml.tpl @@ -3,9 +3,6 @@ 50 10 -1 - 10240 - 255 - 5 50 100 128 diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl index 2f0fd9857242..0167177f4538 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.json.tpl @@ -4,9 +4,6 @@ "floating_ips": 10, "fixed_ips": -1, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl index f56987563cef..cf1c8fe4e40c 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-defaults-get-resp.xml.tpl @@ -3,9 +3,6 @@ 20 10 -1 - 10240 - 255 - 5 10 100 128 diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl index 2f0fd9857242..0167177f4538 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.json.tpl @@ -4,9 +4,6 @@ "floating_ips": 10, "fixed_ips": -1, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl index f56987563cef..cf1c8fe4e40c 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-show-get-resp.xml.tpl @@ -3,9 +3,6 @@ 20 10 -1 - 10240 - 255 - 5 10 100 128 diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl index 8f98181fd79f..d32069728056 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.json.tpl @@ -4,9 +4,6 @@ "fixed_ips": -1, "floating_ips": 10, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 45, "key_pairs": 100, "metadata_items": 128, @@ -14,4 +11,4 @@ "security_group_rules": 20, "security_groups": 10 } -} \ No newline at end of file +} diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.xml.tpl index 8d881801830f..f679ccb0b41c 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.xml.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-force-post-resp.xml.tpl @@ -3,13 +3,10 @@ 20 -1 10 - 10240 - 255 - 5 45 100 128 51200 20 10 - \ No newline at end of file + diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl index a75450cf9630..3af27ada430d 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.json.tpl @@ -3,9 +3,6 @@ "cores": 20, "floating_ips": 10, "fixed_ips": -1, - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl index 6c925b21250b..d9247b74fdff 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/quotas-update-post-resp.xml.tpl @@ -3,9 +3,6 @@ 20 10 -1 - 10240 - 255 - 5 10 100 128 diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl index 2f0fd9857242..0167177f4538 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.json.tpl @@ -4,9 +4,6 @@ "floating_ips": 10, "fixed_ips": -1, "id": "fake_tenant", - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 10, "key_pairs": 100, "metadata_items": 128, diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.xml.tpl index f56987563cef..cf1c8fe4e40c 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.xml.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-show-get-resp.xml.tpl @@ -3,9 +3,6 @@ 20 10 -1 - 10240 - 255 - 5 10 100 128 diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl index 10f8111bd367..c31d12805f33 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.json.tpl @@ -3,9 +3,6 @@ "cores": 20, "floating_ips": 10, "fixed_ips": -1, - "injected_file_content_bytes": 10240, - "injected_file_path_bytes": 255, - "injected_files": 5, "instances": 9, "key_pairs": 100, "metadata_items": 128, diff --git a/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.xml.tpl index 382424995788..f55d2b187567 100644 --- a/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.xml.tpl +++ b/nova/tests/integrated/v3/api_samples/os-quota-sets/user-quotas-update-post-resp.xml.tpl @@ -3,9 +3,6 @@ 20 10 -1 - 10240 - 255 - 5 9 100 128