Modify the default SG rule count logic when creating SG
During the creation of SG, not to exceed the SG rule quota, the number of default SG rules that will be automatically created must be counted. It is always 2 (in case of the default SG, it is 4), but it is wrong since it depends on the default SG rules. Closes-Bug: #2067239 Change-Id: Ic86826b71c1160a6891f09ca1e40135049a8948a
This commit is contained in:
@@ -109,8 +109,12 @@ class SecurityGroupDbMixin(
|
||||
return self.get_security_group(context, existing_def_sg_id)
|
||||
|
||||
with db_api.CONTEXT_WRITER.using(context):
|
||||
delta = len(ext_sg.sg_supported_ethertypes)
|
||||
delta = delta * 2 if default_sg else delta
|
||||
if default_sg:
|
||||
delta = sg_default_rules_obj.SecurityGroupDefaultRule.count(
|
||||
context, used_in_default_sg=True)
|
||||
else:
|
||||
delta = sg_default_rules_obj.SecurityGroupDefaultRule.count(
|
||||
context, used_in_non_default_sg=True)
|
||||
quota.QUOTAS.quota_limit_check(context, tenant_id,
|
||||
security_group_rule=delta)
|
||||
|
||||
|
Reference in New Issue
Block a user