nova-net: Remove remaining nova-network quotas
The 'security_group_rules' [1], 'floating_ips' [2], 'fixed_ips' [3] and 'security_groups' [4] quotas are all nova-network only and can be removed or, more specifically, set to unlimited and ignored until we eventually bump our minimum API microversion. [1] https://review.opendev.org/477700 [2] https://review.opendev.org/457862 [3] https://review.opendev.org/457861 [4] https://review.opendev.org/457860 Change-Id: I9a5362fdf29e3680c59f620c585f3d730e4f6adb Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
110a683486
commit
e10c6125f8
@ -4,11 +4,11 @@
|
||||
"maxImageMeta": 128,
|
||||
"maxPersonality": 5,
|
||||
"maxPersonalitySize": 10240,
|
||||
"maxSecurityGroupRules": 20,
|
||||
"maxSecurityGroups": 10,
|
||||
"maxSecurityGroupRules": -1,
|
||||
"maxSecurityGroups": -1,
|
||||
"maxServerMeta": 128,
|
||||
"maxTotalCores": 20,
|
||||
"maxTotalFloatingIps": 10,
|
||||
"maxTotalFloatingIps": -1,
|
||||
"maxTotalInstances": 10,
|
||||
"maxTotalKeypairs": 100,
|
||||
"maxTotalRAMSize": 51200,
|
||||
|
@ -2,7 +2,7 @@
|
||||
"quota_class_set": {
|
||||
"cores": 20,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"id": "test_class",
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
@ -11,7 +11,7 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,14 @@
|
||||
"instances": 50,
|
||||
"cores": 50,
|
||||
"ram": 51200,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"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,
|
||||
"security_groups": -1,
|
||||
"security_group_rules": -1,
|
||||
"key_pairs": 100
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"quota_class_set": {
|
||||
"cores": 50,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
"injected_files": 5,
|
||||
@ -10,7 +10,7 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"id": "fake_tenant",
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
@ -11,8 +11,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
},
|
||||
"floating_ips": {
|
||||
"in_use": 0,
|
||||
"limit": 10,
|
||||
"limit": -1,
|
||||
"reserved": 0
|
||||
},
|
||||
"id": "fake_tenant",
|
||||
@ -53,12 +53,12 @@
|
||||
},
|
||||
"security_group_rules": {
|
||||
"in_use": 0,
|
||||
"limit": 20,
|
||||
"limit": -1,
|
||||
"reserved": 0
|
||||
},
|
||||
"security_groups": {
|
||||
"in_use": 0,
|
||||
"limit": 10,
|
||||
"limit": -1,
|
||||
"reserved": 0
|
||||
},
|
||||
"server_group_members": {
|
||||
|
@ -2,7 +2,7 @@
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"id": "fake_tenant",
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
@ -11,8 +11,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
"injected_files": 5,
|
||||
@ -10,8 +10,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"quota_set": {
|
||||
"security_groups": 45
|
||||
"cores": 45
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"cores": 45,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
"injected_files": 5,
|
||||
@ -10,8 +10,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 45,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"id": "fake_tenant",
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
@ -11,8 +11,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
"injected_files": 5,
|
||||
@ -10,8 +10,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -61,50 +61,6 @@ The number of megabytes of instance RAM allowed per project.
|
||||
|
||||
Possible values:
|
||||
|
||||
* A positive integer or 0.
|
||||
* -1 to disable the quota.
|
||||
"""),
|
||||
cfg.IntOpt('floating_ips',
|
||||
min=-1,
|
||||
default=10,
|
||||
deprecated_group='DEFAULT',
|
||||
deprecated_name='quota_floating_ips',
|
||||
deprecated_for_removal=True,
|
||||
deprecated_since='15.0.0',
|
||||
deprecated_reason="""
|
||||
nova-network is deprecated, as are any related configuration options.
|
||||
""",
|
||||
help="""
|
||||
The number of floating IPs allowed per project.
|
||||
|
||||
Floating IPs are not allocated to instances by default. Users need to select
|
||||
them from the pool configured by the OpenStack administrator to attach to their
|
||||
instances.
|
||||
|
||||
Possible values:
|
||||
|
||||
* A positive integer or 0.
|
||||
* -1 to disable the quota.
|
||||
"""),
|
||||
cfg.IntOpt('fixed_ips',
|
||||
min=-1,
|
||||
default=-1,
|
||||
deprecated_group='DEFAULT',
|
||||
deprecated_name='quota_fixed_ips',
|
||||
deprecated_for_removal=True,
|
||||
deprecated_since='15.0.0',
|
||||
deprecated_reason="""
|
||||
nova-network is deprecated, as are any related configuration options.
|
||||
""",
|
||||
help="""
|
||||
The number of fixed IPs allowed per project.
|
||||
|
||||
Unlike floating IPs, fixed IPs are allocated dynamically by the network
|
||||
component when instances boot up. This quota value should be at least the
|
||||
number of instances allowed
|
||||
|
||||
Possible values:
|
||||
|
||||
* A positive integer or 0.
|
||||
* -1 to disable the quota.
|
||||
"""),
|
||||
@ -166,45 +122,6 @@ The maximum allowed injected file path length.
|
||||
|
||||
Possible values:
|
||||
|
||||
* A positive integer or 0.
|
||||
* -1 to disable the quota.
|
||||
"""),
|
||||
cfg.IntOpt('security_groups',
|
||||
min=-1,
|
||||
default=10,
|
||||
deprecated_group='DEFAULT',
|
||||
deprecated_name='quota_security_groups',
|
||||
deprecated_for_removal=True,
|
||||
deprecated_since='15.0.0',
|
||||
deprecated_reason="""
|
||||
nova-network is deprecated, as are any related configuration options.
|
||||
""",
|
||||
help="""
|
||||
The number of security groups per project.
|
||||
|
||||
Possible values:
|
||||
|
||||
* A positive integer or 0.
|
||||
* -1 to disable the quota.
|
||||
"""),
|
||||
cfg.IntOpt('security_group_rules',
|
||||
min=-1,
|
||||
default=20,
|
||||
deprecated_group='DEFAULT',
|
||||
deprecated_name='quota_security_group_rules',
|
||||
deprecated_for_removal=True,
|
||||
deprecated_since='15.0.0',
|
||||
deprecated_reason="""
|
||||
nova-network is deprecated, as are any related configuration options.
|
||||
""",
|
||||
help="""
|
||||
The number of security rules per security group.
|
||||
|
||||
The associated rules in each security group control the traffic to instances in
|
||||
the group.
|
||||
|
||||
Possible values:
|
||||
|
||||
* A positive integer or 0.
|
||||
* -1 to disable the quota.
|
||||
"""),
|
||||
|
@ -160,8 +160,7 @@ class DbQuotaDriver(object):
|
||||
for example:
|
||||
{'project_id': 'project-uuid',
|
||||
'user_id': 'user-uuid',
|
||||
'instances': {'in_use': 5},
|
||||
'fixed_ips': {'in_use': 5}}
|
||||
'instances': {'in_use': 5}}
|
||||
"""
|
||||
usages = {}
|
||||
for resource in resources.values():
|
||||
@ -176,8 +175,7 @@ class DbQuotaDriver(object):
|
||||
# of multiple times). So, a count of any one of them contains
|
||||
# counts for the others and we can avoid re-counting things.
|
||||
continue
|
||||
if resource.name in ('key_pairs', 'server_group_members',
|
||||
'security_group_rules'):
|
||||
if resource.name in ('key_pairs', 'server_group_members'):
|
||||
# These per user resources are special cases whose usages
|
||||
# are not considered when validating limit create/update or
|
||||
# displaying used limits. They are always zero.
|
||||
@ -546,7 +544,7 @@ class DbQuotaDriver(object):
|
||||
# together.
|
||||
|
||||
# per project quota limits (quotas that have no concept of
|
||||
# user-scoping: fixed_ips, floating_ips)
|
||||
# user-scoping: <none>)
|
||||
project_quotas = objects.Quotas.get_all_by_project(context, project_id)
|
||||
# per user quotas, project quota limits (for quotas that have
|
||||
# user-scoping, limits for the project)
|
||||
@ -586,9 +584,9 @@ class DbQuotaDriver(object):
|
||||
headroom=headroom)
|
||||
|
||||
# This is for resources that are counted across a project and
|
||||
# across a user (instances, cores, ram, security_groups,
|
||||
# server_groups). The project_values must pass the quota for the
|
||||
# project and the user_values must pass the quota for the user.
|
||||
# across a user (instances, cores, ram, server_groups). The
|
||||
# project_values must pass the quota for the project and the
|
||||
# user_values must pass the quota for the user.
|
||||
over_user_quota = False
|
||||
overs = []
|
||||
for key in user_values.keys():
|
||||
@ -613,10 +611,8 @@ class DbQuotaDriver(object):
|
||||
|
||||
class NoopQuotaDriver(object):
|
||||
"""Driver that turns quotas calls into no-ops and pretends that quotas
|
||||
for all resources are unlimited. This can be used if you do not
|
||||
wish to have any quota checking. For instance, with nova compute
|
||||
cells, the parent cell should do quota checking, but the child cell
|
||||
should not.
|
||||
for all resources are unlimited. This can be used if you do not
|
||||
wish to have any quota checking.
|
||||
"""
|
||||
|
||||
def get_defaults(self, context, resources):
|
||||
@ -808,8 +804,7 @@ class CountableResource(AbsoluteResource):
|
||||
|
||||
Countable resources are those resources which directly
|
||||
correspond to objects in the database, but for which a count
|
||||
by project ID is inappropriate e.g. security_group_rules,
|
||||
keypairs, etc.
|
||||
by project ID is inappropriate e.g. keypairs
|
||||
A CountableResource must be constructed with a counting
|
||||
function, which will be called to determine the current counts
|
||||
of the resource.
|
||||
@ -1102,23 +1097,6 @@ def _keypair_get_count_by_user(context, user_id):
|
||||
return {'user': {'key_pairs': count}}
|
||||
|
||||
|
||||
def _security_group_count(context, project_id, user_id=None):
|
||||
"""Get the counts of security groups in the database.
|
||||
|
||||
:param context: The request context for database access
|
||||
:param project_id: The project_id to count across
|
||||
:param user_id: The user_id to count across
|
||||
:returns: A dict containing the project-scoped counts and user-scoped
|
||||
counts if user_id is specified. For example:
|
||||
|
||||
{'project': {'security_groups': <count across project>},
|
||||
'user': {'security_groups': <count across user>}}
|
||||
"""
|
||||
# NOTE(melwitt): This assumes a single cell.
|
||||
return objects.SecurityGroupList.get_counts(context, project_id,
|
||||
user_id=user_id)
|
||||
|
||||
|
||||
def _server_group_count_members_by_user_legacy(context, group, user_id):
|
||||
# NOTE(melwitt): This is mostly duplicated from
|
||||
# InstanceGroup.count_members_by_user() to query across multiple cells.
|
||||
@ -1189,18 +1167,6 @@ def _server_group_count_members_by_user(context, group, user_id):
|
||||
user_id)
|
||||
|
||||
|
||||
def _fixed_ip_count(context, project_id):
|
||||
# NOTE(melwitt): This assumes a single cell.
|
||||
count = objects.FixedIPList.get_count_by_project(context, project_id)
|
||||
return {'project': {'fixed_ips': count}}
|
||||
|
||||
|
||||
def _floating_ip_count(context, project_id):
|
||||
# NOTE(melwitt): This assumes a single cell.
|
||||
count = objects.FloatingIPList.get_count_by_project(context, project_id)
|
||||
return {'project': {'floating_ips': count}}
|
||||
|
||||
|
||||
def _instances_cores_ram_count_legacy(context, project_id, user_id=None):
|
||||
"""Get the counts of instances, cores, and ram in cell databases.
|
||||
|
||||
@ -1323,15 +1289,6 @@ def _server_group_count(context, project_id, user_id=None):
|
||||
user_id=user_id)
|
||||
|
||||
|
||||
def _security_group_rule_count_by_group(context, security_group_id):
|
||||
count = db.security_group_rule_count_by_group(context, security_group_id)
|
||||
# NOTE(melwitt): Neither 'project' nor 'user' fit perfectly here as
|
||||
# security group rules are counted per security group, not by user or
|
||||
# project. But, the quota limits for security_group_rules can be scoped to
|
||||
# a user, so we'll use 'user' here.
|
||||
return {'user': {'security_group_rules': count}}
|
||||
|
||||
|
||||
QUOTAS = QuotaEngine(
|
||||
resources=[
|
||||
CountableResource(
|
||||
@ -1340,12 +1297,6 @@ QUOTAS = QuotaEngine(
|
||||
'cores', _instances_cores_ram_count, 'cores'),
|
||||
CountableResource(
|
||||
'ram', _instances_cores_ram_count, 'ram'),
|
||||
CountableResource(
|
||||
'security_groups', _security_group_count, 'security_groups'),
|
||||
CountableResource(
|
||||
'fixed_ips', _fixed_ip_count, 'fixed_ips'),
|
||||
CountableResource(
|
||||
'floating_ips', _floating_ip_count, 'floating_ips'),
|
||||
AbsoluteResource(
|
||||
'metadata_items', 'metadata_items'),
|
||||
AbsoluteResource(
|
||||
@ -1354,9 +1305,6 @@ QUOTAS = QuotaEngine(
|
||||
'injected_file_content_bytes', 'injected_file_content_bytes'),
|
||||
AbsoluteResource(
|
||||
'injected_file_path_bytes', 'injected_file_path_length'),
|
||||
CountableResource(
|
||||
'security_group_rules', _security_group_rule_count_by_group,
|
||||
'security_group_rules'),
|
||||
CountableResource(
|
||||
'key_pairs', _keypair_get_count_by_user, 'key_pairs'),
|
||||
CountableResource(
|
||||
@ -1364,6 +1312,12 @@ QUOTAS = QuotaEngine(
|
||||
CountableResource(
|
||||
'server_group_members', _server_group_count_members_by_user,
|
||||
'server_group_members'),
|
||||
# Deprecated nova-network quotas, retained to avoid changing API
|
||||
# responses
|
||||
AbsoluteResource('fixed_ips'),
|
||||
AbsoluteResource('floating_ips'),
|
||||
AbsoluteResource('security_groups'),
|
||||
AbsoluteResource('security_group_rules'),
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -6,12 +6,12 @@
|
||||
"maxPersonalitySize": 10240,
|
||||
"maxServerMeta": 128,
|
||||
"maxTotalCores": 20,
|
||||
"maxTotalFloatingIps": 10,
|
||||
"maxTotalFloatingIps": -1,
|
||||
"maxTotalInstances": 10,
|
||||
"maxTotalKeypairs": 100,
|
||||
"maxTotalRAMSize": 51200,
|
||||
"maxSecurityGroups": 10,
|
||||
"maxSecurityGroupRules": 20,
|
||||
"maxSecurityGroups": -1,
|
||||
"maxSecurityGroupRules": -1,
|
||||
"maxServerGroups": 10,
|
||||
"maxServerGroupMembers": 10,
|
||||
"totalCoresUsed": 0,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"quota_class_set": {
|
||||
"cores": 20,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"fixed_ips": -1,
|
||||
"id": "%(set_id)s",
|
||||
"injected_file_content_bytes": 10240,
|
||||
@ -11,7 +11,7 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,14 @@
|
||||
"instances": 50,
|
||||
"cores": 50,
|
||||
"ram": 51200,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"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,
|
||||
"security_groups": -1,
|
||||
"security_group_rules": -1,
|
||||
"key_pairs": 100
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"quota_class_set": {
|
||||
"cores": 50,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"fixed_ips": -1,
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
@ -10,7 +10,7 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"fixed_ips": -1,
|
||||
"id": "fake_tenant",
|
||||
"injected_file_content_bytes": 10240,
|
||||
@ -11,8 +11,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
},
|
||||
"floating_ips": {
|
||||
"in_use": 0,
|
||||
"limit": 10,
|
||||
"limit": -1,
|
||||
"reserved": 0
|
||||
},
|
||||
"id": "fake_tenant",
|
||||
@ -53,12 +53,12 @@
|
||||
},
|
||||
"security_group_rules": {
|
||||
"in_use": 0,
|
||||
"limit": 20,
|
||||
"limit": -1,
|
||||
"reserved": 0
|
||||
},
|
||||
"security_groups": {
|
||||
"in_use": 0,
|
||||
"limit": 10,
|
||||
"limit": -1,
|
||||
"reserved": 0
|
||||
},
|
||||
"server_group_members": {
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"floating_ips": 10,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": -1,
|
||||
"id": "fake_tenant",
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
@ -11,8 +11,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"fixed_ips": -1,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
"injected_files": 5,
|
||||
@ -10,8 +10,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"quota_set": {
|
||||
"security_groups": 45
|
||||
"cores": 45
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"floating_ips": 10,
|
||||
"cores": 45,
|
||||
"floating_ips": -1,
|
||||
"fixed_ips": -1,
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
@ -10,8 +10,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 45,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"fixed_ips": -1,
|
||||
"id": "fake_tenant",
|
||||
"injected_file_content_bytes": 10240,
|
||||
@ -11,8 +11,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"quota_set": {
|
||||
"cores": 20,
|
||||
"floating_ips": 10,
|
||||
"floating_ips": -1,
|
||||
"fixed_ips": -1,
|
||||
"injected_file_content_bytes": 10240,
|
||||
"injected_file_path_bytes": 255,
|
||||
@ -10,8 +10,8 @@
|
||||
"key_pairs": 100,
|
||||
"metadata_items": 128,
|
||||
"ram": 51200,
|
||||
"security_group_rules": 20,
|
||||
"security_groups": 10,
|
||||
"security_group_rules": -1,
|
||||
"security_groups": -1,
|
||||
"server_groups": 10,
|
||||
"server_group_members": 10
|
||||
}
|
||||
|
@ -26,12 +26,12 @@ class QuotaClassSetsTestV21(test.TestCase):
|
||||
validation_error = exception.ValidationError
|
||||
api_version = '2.1'
|
||||
quota_resources = {'metadata_items': 128,
|
||||
'ram': 51200, 'floating_ips': 10,
|
||||
'ram': 51200, 'floating_ips': -1,
|
||||
'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,
|
||||
'security_groups': -1,
|
||||
'security_group_rules': -1, 'key_pairs': 100,
|
||||
'injected_file_path_bytes': 255}
|
||||
filtered_quotas = None
|
||||
|
||||
@ -51,10 +51,10 @@ class QuotaClassSetsTestV21(test.TestCase):
|
||||
def _check_filtered_extended_quota(self, quota_set):
|
||||
self.assertNotIn('server_groups', quota_set)
|
||||
self.assertNotIn('server_group_members', quota_set)
|
||||
self.assertEqual(10, quota_set['floating_ips'])
|
||||
self.assertEqual(-1, quota_set['floating_ips'])
|
||||
self.assertEqual(-1, quota_set['fixed_ips'])
|
||||
self.assertEqual(10, quota_set['security_groups'])
|
||||
self.assertEqual(20, quota_set['security_group_rules'])
|
||||
self.assertEqual(-1, quota_set['security_groups'])
|
||||
self.assertEqual(-1, quota_set['security_group_rules'])
|
||||
|
||||
def test_format_quota_set(self):
|
||||
quota_set = self.controller._format_quota_set('test_class',
|
||||
|
@ -27,10 +27,10 @@ from nova.tests.unit.api.openstack import fakes
|
||||
|
||||
def quota_set(id, include_server_group_quotas=True):
|
||||
res = {'quota_set': {'id': id, 'metadata_items': 128,
|
||||
'ram': 51200, 'floating_ips': 10, 'fixed_ips': -1,
|
||||
'ram': 51200, 'floating_ips': -1, 'fixed_ips': -1,
|
||||
'instances': 10, 'injected_files': 5, 'cores': 20,
|
||||
'injected_file_content_bytes': 10240,
|
||||
'security_groups': 10, 'security_group_rules': 20,
|
||||
'security_groups': -1, 'security_group_rules': -1,
|
||||
'key_pairs': 100, 'injected_file_path_bytes': 255}}
|
||||
if include_server_group_quotas:
|
||||
res['quota_set']['server_groups'] = 10
|
||||
@ -66,14 +66,14 @@ class QuotaSetsTestV21(BaseQuotaSetsTest):
|
||||
'instances': 10,
|
||||
'cores': 20,
|
||||
'ram': 51200,
|
||||
'floating_ips': 10,
|
||||
'floating_ips': -1,
|
||||
'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,
|
||||
'security_groups': -1,
|
||||
'security_group_rules': -1,
|
||||
'key_pairs': 100,
|
||||
}
|
||||
if self.include_server_group_quotas:
|
||||
@ -96,14 +96,14 @@ class QuotaSetsTestV21(BaseQuotaSetsTest):
|
||||
self.assertEqual(qs['instances'], 10)
|
||||
self.assertEqual(qs['cores'], 20)
|
||||
self.assertEqual(qs['ram'], 51200)
|
||||
self.assertEqual(qs['floating_ips'], 10)
|
||||
self.assertEqual(qs['floating_ips'], -1)
|
||||
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['security_groups'], -1)
|
||||
self.assertEqual(qs['security_group_rules'], -1)
|
||||
self.assertEqual(qs['key_pairs'], 100)
|
||||
if self.include_server_group_quotas:
|
||||
self.assertEqual(qs['server_groups'], 10)
|
||||
@ -212,13 +212,13 @@ class QuotaSetsTestV21(BaseQuotaSetsTest):
|
||||
|
||||
def test_quotas_update_zero_value(self):
|
||||
body = {'quota_set': {'instances': 0, 'cores': 0,
|
||||
'ram': 0, 'floating_ips': 0,
|
||||
'ram': 0, 'floating_ips': -1,
|
||||
'metadata_items': 0,
|
||||
'injected_files': 0,
|
||||
'injected_file_content_bytes': 0,
|
||||
'injected_file_path_bytes': 0,
|
||||
'security_groups': 0,
|
||||
'security_group_rules': 0,
|
||||
'security_groups': -1,
|
||||
'security_group_rules': -1,
|
||||
'key_pairs': 100, 'fixed_ips': -1}}
|
||||
if self.include_server_group_quotas:
|
||||
body['quota_set']['server_groups'] = 10
|
||||
@ -437,13 +437,13 @@ class UserQuotasTestV21(BaseQuotaSetsTest):
|
||||
|
||||
def test_user_quotas_update(self):
|
||||
body = {'quota_set': {'instances': 10, 'cores': 20,
|
||||
'ram': 51200, 'floating_ips': 10,
|
||||
'ram': 51200, 'floating_ips': -1,
|
||||
'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,
|
||||
'security_groups': -1,
|
||||
'security_group_rules': -1,
|
||||
'key_pairs': 100}}
|
||||
if self.include_server_group_quotas:
|
||||
body['quota_set']['server_groups'] = 10
|
||||
@ -578,7 +578,7 @@ class QuotaSetsTestV236(test.NoDBTestCase):
|
||||
self.quotas = {
|
||||
'cores': {'limit': 20},
|
||||
'fixed_ips': {'limit': -1},
|
||||
'floating_ips': {'limit': 10},
|
||||
'floating_ips': {'limit': -1},
|
||||
'injected_file_content_bytes': {'limit': 10240},
|
||||
'injected_file_path_bytes': {'limit': 255},
|
||||
'injected_files': {'limit': 5},
|
||||
@ -586,15 +586,15 @@ class QuotaSetsTestV236(test.NoDBTestCase):
|
||||
'key_pairs': {'limit': 100},
|
||||
'metadata_items': {'limit': 128},
|
||||
'ram': {'limit': 51200},
|
||||
'security_group_rules': {'limit': 20},
|
||||
'security_groups': {'limit': 10},
|
||||
'security_group_rules': {'limit': -1},
|
||||
'security_groups': {'limit': -1},
|
||||
'server_group_members': {'limit': 10},
|
||||
'server_groups': {'limit': 10}
|
||||
}
|
||||
self.defaults = {
|
||||
'cores': 20,
|
||||
'fixed_ips': -1,
|
||||
'floating_ips': 10,
|
||||
'floating_ips': -1,
|
||||
'injected_file_content_bytes': 10240,
|
||||
'injected_file_path_bytes': 255,
|
||||
'injected_files': 5,
|
||||
@ -602,8 +602,8 @@ class QuotaSetsTestV236(test.NoDBTestCase):
|
||||
'key_pairs': 100,
|
||||
'metadata_items': 128,
|
||||
'ram': 51200,
|
||||
'security_group_rules': 20,
|
||||
'security_groups': 10,
|
||||
'security_group_rules': -1,
|
||||
'security_groups': -1,
|
||||
'server_group_members': 10,
|
||||
'server_groups': 10
|
||||
}
|
||||
|
@ -36,10 +36,8 @@ def _get_fake_get_usages(updates=None):
|
||||
# These values are not realistic (they should all be 0) and are
|
||||
# only for testing that countable usages get included in the
|
||||
# results.
|
||||
usages = {'security_group_rules': {'in_use': 1},
|
||||
'key_pairs': {'in_use': 2},
|
||||
usages = {'key_pairs': {'in_use': 2},
|
||||
'server_group_members': {'in_use': 3},
|
||||
'floating_ips': {'in_use': 2},
|
||||
'instances': {'in_use': 2},
|
||||
'cores': {'in_use': 4},
|
||||
'ram': {'in_use': 10 * 1024}}
|
||||
@ -503,14 +501,10 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
self.flags(instances=10,
|
||||
cores=20,
|
||||
ram=50 * 1024,
|
||||
floating_ips=10,
|
||||
fixed_ips=10,
|
||||
metadata_items=128,
|
||||
injected_files=5,
|
||||
injected_file_content_bytes=10 * 1024,
|
||||
injected_file_path_length=255,
|
||||
security_groups=10,
|
||||
security_group_rules=20,
|
||||
server_groups=10,
|
||||
server_group_members=10,
|
||||
group='quota'
|
||||
@ -531,17 +525,17 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
instances=5,
|
||||
cores=20,
|
||||
ram=25 * 1024,
|
||||
floating_ips=10,
|
||||
fixed_ips=10,
|
||||
metadata_items=64,
|
||||
injected_files=5,
|
||||
injected_file_content_bytes=5 * 1024,
|
||||
injected_file_path_bytes=255,
|
||||
security_groups=10,
|
||||
security_group_rules=20,
|
||||
key_pairs=100,
|
||||
server_groups=10,
|
||||
server_group_members=10,
|
||||
security_groups=-1,
|
||||
security_group_rules=-1,
|
||||
fixed_ips=-1,
|
||||
floating_ips=-1,
|
||||
))
|
||||
|
||||
def _stub_quota_class_get_default(self):
|
||||
@ -579,17 +573,17 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
instances=5,
|
||||
cores=20,
|
||||
ram=25 * 1024,
|
||||
floating_ips=10,
|
||||
fixed_ips=10,
|
||||
metadata_items=64,
|
||||
injected_files=5,
|
||||
injected_file_content_bytes=5 * 1024,
|
||||
injected_file_path_bytes=255,
|
||||
security_groups=10,
|
||||
security_group_rules=20,
|
||||
key_pairs=100,
|
||||
server_groups=10,
|
||||
server_group_members=10,
|
||||
floating_ips=-1,
|
||||
fixed_ips=-1,
|
||||
security_groups=-1,
|
||||
security_group_rules=-1,
|
||||
))
|
||||
|
||||
def _stub_get_by_project_and_user(self):
|
||||
@ -624,10 +618,6 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
return {'project': {'instances': 2, 'cores': 4, 'ram': 1024},
|
||||
'user': {'instances': 1, 'cores': 2, 'ram': 512}}
|
||||
|
||||
def fake_security_group_count(*a, **k):
|
||||
return {'project': {'security_groups': 2},
|
||||
'user': {'security_groups': 1}}
|
||||
|
||||
def fake_server_group_count(*a, **k):
|
||||
return {'project': {'server_groups': 5},
|
||||
'user': {'server_groups': 3}}
|
||||
@ -642,23 +632,17 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
'cores', fake_instances_cores_ram_count, 'cores')
|
||||
resources['ram'] = quota.CountableResource(
|
||||
'ram', fake_instances_cores_ram_count, 'ram')
|
||||
resources['security_groups'] = quota.CountableResource(
|
||||
'security_groups', fake_security_group_count, 'security_groups')
|
||||
resources['floating_ips'] = quota.CountableResource(
|
||||
'floating_ips', lambda *a, **k: {'project': {'floating_ips': 4}},
|
||||
'floating_ips')
|
||||
resources['fixed_ips'] = quota.CountableResource(
|
||||
'fixed_ips', lambda *a, **k: {'project': {'fixed_ips': 5}},
|
||||
'fixed_ips')
|
||||
resources['server_groups'] = quota.CountableResource(
|
||||
'server_groups', fake_server_group_count, 'server_groups')
|
||||
resources['server_group_members'] = quota.CountableResource(
|
||||
'server_group_members',
|
||||
lambda *a, **k: {'user': {'server_group_members': 7}},
|
||||
'server_group_members')
|
||||
resources['security_group_rules'] = quota.CountableResource(
|
||||
'security_group_rules',
|
||||
lambda *a, **k: {'project': {'security_group_rules': 8}},
|
||||
resources['floating_ips'] = quota.AbsoluteResource('floating_ips')
|
||||
resources['fixed_ips'] = quota.AbsoluteResource('fixed_ips')
|
||||
resources['security_groups'] = quota.AbsoluteResource(
|
||||
'security_groups')
|
||||
resources['security_group_rules'] = quota.AbsoluteResource(
|
||||
'security_group_rules')
|
||||
return resources
|
||||
|
||||
@ -673,12 +657,8 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
'instances': {'in_use': 2},
|
||||
'cores': {'in_use': 4},
|
||||
'ram': {'in_use': 1024},
|
||||
'security_groups': {'in_use': 2},
|
||||
'floating_ips': {'in_use': 4},
|
||||
'fixed_ips': {'in_use': 5},
|
||||
'server_groups': {'in_use': 5},
|
||||
'server_group_members': {'in_use': 0},
|
||||
'security_group_rules': {'in_use': 0}}
|
||||
'server_group_members': {'in_use': 0}}
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
def test_get_usages_for_user(self):
|
||||
@ -692,12 +672,8 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
'instances': {'in_use': 1},
|
||||
'cores': {'in_use': 2},
|
||||
'ram': {'in_use': 512},
|
||||
'security_groups': {'in_use': 1},
|
||||
'floating_ips': {'in_use': 4},
|
||||
'fixed_ips': {'in_use': 5},
|
||||
'server_groups': {'in_use': 3},
|
||||
'server_group_members': {'in_use': 0},
|
||||
'security_group_rules': {'in_use': 0}}
|
||||
'server_group_members': {'in_use': 0}}
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
@mock.patch('nova.quota.DbQuotaDriver._get_usages',
|
||||
@ -731,11 +707,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=10 * 1024,
|
||||
),
|
||||
floating_ips=dict(
|
||||
limit=10,
|
||||
in_use=2,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
fixed_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
metadata_items=dict(
|
||||
@ -755,12 +731,12 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=0,
|
||||
),
|
||||
security_groups=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
security_group_rules=dict(
|
||||
limit=20,
|
||||
in_use=1,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
key_pairs=dict(
|
||||
limit=100,
|
||||
@ -841,11 +817,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=10 * 1024,
|
||||
),
|
||||
floating_ips=dict(
|
||||
limit=10,
|
||||
in_use=2,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
fixed_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
metadata_items=dict(
|
||||
@ -865,12 +841,12 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=0,
|
||||
),
|
||||
security_groups=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
security_group_rules=dict(
|
||||
limit=20,
|
||||
in_use=1,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
key_pairs=dict(
|
||||
limit=100,
|
||||
@ -920,14 +896,14 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
remains=25 * 1024,
|
||||
),
|
||||
floating_ips=dict(
|
||||
limit=10,
|
||||
in_use=2,
|
||||
remains=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
remains=-1,
|
||||
),
|
||||
fixed_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
remains=10,
|
||||
remains=-1,
|
||||
),
|
||||
metadata_items=dict(
|
||||
limit=64,
|
||||
@ -950,14 +926,14 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
remains=127,
|
||||
),
|
||||
security_groups=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
remains=10,
|
||||
remains=-1,
|
||||
),
|
||||
security_group_rules=dict(
|
||||
limit=20,
|
||||
in_use=1,
|
||||
remains=20,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
remains=-1,
|
||||
),
|
||||
key_pairs=dict(
|
||||
limit=100,
|
||||
@ -1006,11 +982,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=10 * 1024,
|
||||
),
|
||||
floating_ips=dict(
|
||||
limit=10,
|
||||
in_use=2,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
fixed_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
metadata_items=dict(
|
||||
@ -1030,12 +1006,12 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=0,
|
||||
),
|
||||
security_groups=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
security_group_rules=dict(
|
||||
limit=20,
|
||||
in_use=1,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
key_pairs=dict(
|
||||
limit=100,
|
||||
@ -1080,11 +1056,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=10 * 1024,
|
||||
),
|
||||
floating_ips=dict(
|
||||
limit=10,
|
||||
in_use=2,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
fixed_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
metadata_items=dict(
|
||||
@ -1104,12 +1080,12 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=0,
|
||||
),
|
||||
security_groups=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
security_group_rules=dict(
|
||||
limit=20,
|
||||
in_use=1,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
key_pairs=dict(
|
||||
limit=100,
|
||||
@ -1157,11 +1133,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=10 * 1024,
|
||||
),
|
||||
floating_ips=dict(
|
||||
limit=10,
|
||||
in_use=2,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
fixed_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
metadata_items=dict(
|
||||
@ -1181,12 +1157,12 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=0,
|
||||
),
|
||||
security_groups=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
security_group_rules=dict(
|
||||
limit=20,
|
||||
in_use=1,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
key_pairs=dict(
|
||||
limit=100,
|
||||
@ -1233,11 +1209,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=10 * 1024,
|
||||
),
|
||||
floating_ips=dict(
|
||||
limit=10,
|
||||
in_use=2,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
fixed_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
metadata_items=dict(
|
||||
@ -1257,12 +1233,12 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use=0,
|
||||
),
|
||||
security_groups=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
security_group_rules=dict(
|
||||
limit=20,
|
||||
in_use=1,
|
||||
limit=-1,
|
||||
in_use=0,
|
||||
),
|
||||
key_pairs=dict(
|
||||
limit=100,
|
||||
@ -1300,10 +1276,10 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
limit=25 * 1024,
|
||||
),
|
||||
floating_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
),
|
||||
fixed_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
),
|
||||
metadata_items=dict(
|
||||
limit=64,
|
||||
@ -1318,10 +1294,10 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
limit=127,
|
||||
),
|
||||
security_groups=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
),
|
||||
security_group_rules=dict(
|
||||
limit=20,
|
||||
limit=-1,
|
||||
),
|
||||
key_pairs=dict(
|
||||
limit=100,
|
||||
@ -1356,10 +1332,10 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
limit=25 * 1024,
|
||||
),
|
||||
floating_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
),
|
||||
fixed_ips=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
),
|
||||
metadata_items=dict(
|
||||
limit=64,
|
||||
@ -1374,10 +1350,10 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
limit=127,
|
||||
),
|
||||
security_groups=dict(
|
||||
limit=10,
|
||||
limit=-1,
|
||||
),
|
||||
security_group_rules=dict(
|
||||
limit=20,
|
||||
limit=-1,
|
||||
),
|
||||
key_pairs=dict(
|
||||
limit=100,
|
||||
@ -1394,7 +1370,7 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
|
||||
def fake_quota_get_all_by_project(context, project_id):
|
||||
self.calls.append('quota_get_all_by_project')
|
||||
return {'floating_ips': 20}
|
||||
return {'floating_ips': -1}
|
||||
|
||||
def fake_get_project_quotas(dbdrv, context, resources, project_id,
|
||||
quota_class=None,
|
||||
@ -1412,9 +1388,9 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
in_use = 5
|
||||
limit = -1
|
||||
elif k == 'floating_ips':
|
||||
remains = 20
|
||||
remains = -1
|
||||
in_use = 0
|
||||
limit = 20
|
||||
limit = -1
|
||||
else:
|
||||
remains = v.default
|
||||
in_use = 0
|
||||
@ -1480,11 +1456,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
},
|
||||
'floating_ips': {
|
||||
'minimum': 0,
|
||||
'maximum': 20,
|
||||
'maximum': -1,
|
||||
},
|
||||
'fixed_ips': {
|
||||
'minimum': 0,
|
||||
'maximum': 10,
|
||||
'maximum': -1,
|
||||
},
|
||||
'metadata_items': {
|
||||
'minimum': 0,
|
||||
@ -1504,11 +1480,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
},
|
||||
'security_groups': {
|
||||
'minimum': 0,
|
||||
'maximum': 10,
|
||||
'maximum': -1,
|
||||
},
|
||||
'security_group_rules': {
|
||||
'minimum': 0,
|
||||
'maximum': 20,
|
||||
'maximum': -1,
|
||||
},
|
||||
'key_pairs': {
|
||||
'minimum': 0,
|
||||
@ -1620,11 +1596,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
},
|
||||
'floating_ips': {
|
||||
'minimum': 0,
|
||||
'maximum': 20,
|
||||
'maximum': -1,
|
||||
},
|
||||
'fixed_ips': {
|
||||
'minimum': 0,
|
||||
'maximum': 10,
|
||||
'maximum': -1,
|
||||
},
|
||||
'metadata_items': {
|
||||
'minimum': 0,
|
||||
@ -1644,11 +1620,11 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
},
|
||||
'security_groups': {
|
||||
'minimum': 0,
|
||||
'maximum': 10,
|
||||
'maximum': -1,
|
||||
},
|
||||
'security_group_rules': {
|
||||
'minimum': 0,
|
||||
'maximum': 20,
|
||||
'maximum': -1,
|
||||
},
|
||||
'key_pairs': {
|
||||
'minimum': 0,
|
||||
@ -1773,7 +1749,7 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
ctxt = FakeContext('test_project', 'test_class')
|
||||
resources = self._get_fake_countable_resources()
|
||||
# Check: only project_values, only user_values, and then both.
|
||||
kwargs = [{'project_values': {'fixed_ips': 10241}},
|
||||
kwargs = [{'project_values': {'instances': 512}},
|
||||
{'user_values': {'key_pairs': 256}},
|
||||
{'project_values': {'instances': 512},
|
||||
'user_values': {'instances': 256}}]
|
||||
@ -1783,7 +1759,6 @@ class DbQuotaDriverTestCase(test.TestCase):
|
||||
ctxt, resources, **kwarg)
|
||||
|
||||
def test_limit_check_project_and_user_unlimited(self):
|
||||
self.flags(fixed_ips=-1, group='quota')
|
||||
self.flags(key_pairs=-1, group='quota')
|
||||
self.flags(instances=-1, group='quota')
|
||||
self._stub_get_project_quotas()
|
||||
@ -1833,13 +1808,10 @@ class NoopQuotaDriverTestCase(test.TestCase):
|
||||
self.flags(instances=10,
|
||||
cores=20,
|
||||
ram=50 * 1024,
|
||||
floating_ips=10,
|
||||
metadata_items=128,
|
||||
injected_files=5,
|
||||
injected_file_content_bytes=10 * 1024,
|
||||
injected_file_path_length=255,
|
||||
security_groups=10,
|
||||
security_group_rules=20,
|
||||
group='quota'
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user