Merge "Hide injected_file related quotas for V3 API"
This commit is contained in:
commit
62e549eb02
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>20</cores>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<floating_ips>10</floating_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>10</security_groups>
|
||||
</quota_class_set>
|
||||
</quota_class_set>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>50</cores>
|
||||
<floating_ips>10</floating_ips>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>50</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>10</security_groups>
|
||||
</quota_class_set>
|
||||
</quota_class_set>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>50</cores>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<floating_ips>10</floating_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>50</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>10</security_groups>
|
||||
</quota_class_set>
|
||||
</quota_class_set>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>20</cores>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<floating_ips>10</floating_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>10</security_groups>
|
||||
</quota_set>
|
||||
</quota_set>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>20</cores>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<floating_ips>10</floating_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>10</security_groups>
|
||||
</quota_set>
|
||||
</quota_set>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>20</cores>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<floating_ips>10</floating_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>45</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>10</security_groups>
|
||||
</quota_set>
|
||||
</quota_set>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>20</cores>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<floating_ips>10</floating_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>45</security_groups>
|
||||
</quota_set>
|
||||
</quota_set>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>20</cores>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<floating_ips>10</floating_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>10</security_groups>
|
||||
</quota_set>
|
||||
</quota_set>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>20</cores>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<floating_ips>10</floating_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>9</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>10</security_groups>
|
||||
</quota_set>
|
||||
</quota_set>
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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 = ("<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||
'<quota_class_set>'
|
||||
'<metadata_items>10</metadata_items>'
|
||||
'<injected_file_content_bytes>20'
|
||||
'</injected_file_content_bytes>'
|
||||
'<ram>50</ram>'
|
||||
'<floating_ips>60</floating_ips>'
|
||||
'<fixed_ips>-1</fixed_ips>'
|
||||
'<instances>70</instances>'
|
||||
'<injected_files>80</injected_files>'
|
||||
'<cores>90</cores>'
|
||||
'<security_groups>10</security_groups>'
|
||||
'<security_group_rules>20</security_group_rules>'
|
||||
|
@ -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 = ("<?xml version='1.0' encoding='UTF-8'?>\n"
|
||||
'<quota_set>'
|
||||
'<metadata_items>10</metadata_items>'
|
||||
'<injected_file_content_bytes>20'
|
||||
'</injected_file_content_bytes>'
|
||||
'<ram>50</ram>'
|
||||
'<floating_ips>60</floating_ips>'
|
||||
'<fixed_ips>-1</fixed_ips>'
|
||||
'<instances>70</instances>'
|
||||
'<injected_files>80</injected_files>'
|
||||
'<security_groups>10</security_groups>'
|
||||
'<security_group_rules>20</security_group_rules>'
|
||||
'<key_pairs>100</key_pairs>'
|
||||
|
@ -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,
|
||||
|
@ -3,9 +3,6 @@
|
||||
<cores>20</cores>
|
||||
<floating_ips>10</floating_ips>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
|
@ -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
|
||||
|
@ -3,9 +3,6 @@
|
||||
<cores>50</cores>
|
||||
<floating_ips>10</floating_ips>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>50</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
|
@ -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,
|
||||
|
@ -3,9 +3,6 @@
|
||||
<cores>50</cores>
|
||||
<floating_ips>10</floating_ips>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>50</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
|
@ -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,
|
||||
|
@ -3,9 +3,6 @@
|
||||
<cores>20</cores>
|
||||
<floating_ips>10</floating_ips>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
|
@ -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,
|
||||
|
@ -3,9 +3,6 @@
|
||||
<cores>20</cores>
|
||||
<floating_ips>10</floating_ips>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,10 @@
|
||||
<cores>20</cores>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<floating_ips>10</floating_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>45</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
<ram>51200</ram>
|
||||
<security_group_rules>20</security_group_rules>
|
||||
<security_groups>10</security_groups>
|
||||
</quota_set>
|
||||
</quota_set>
|
||||
|
@ -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,
|
||||
|
@ -3,9 +3,6 @@
|
||||
<cores>20</cores>
|
||||
<floating_ips>10</floating_ips>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
|
@ -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,
|
||||
|
@ -3,9 +3,6 @@
|
||||
<cores>20</cores>
|
||||
<floating_ips>10</floating_ips>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>10</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
|
@ -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,
|
||||
|
@ -3,9 +3,6 @@
|
||||
<cores>20</cores>
|
||||
<floating_ips>10</floating_ips>
|
||||
<fixed_ips>-1</fixed_ips>
|
||||
<injected_file_content_bytes>10240</injected_file_content_bytes>
|
||||
<injected_file_path_bytes>255</injected_file_path_bytes>
|
||||
<injected_files>5</injected_files>
|
||||
<instances>9</instances>
|
||||
<key_pairs>100</key_pairs>
|
||||
<metadata_items>128</metadata_items>
|
||||
|
Loading…
Reference in New Issue
Block a user