Merge "Allow turning off max_stacks limit"

This commit is contained in:
Zuul 2021-03-15 14:05:32 +00:00 committed by Gerrit Code Review
commit c7babfd3c2
2 changed files with 5 additions and 4 deletions

View File

@ -154,9 +154,9 @@ engine_opts = [
help=_('Maximum resources allowed per top-level stack. '
'-1 stands for unlimited.')),
cfg.IntOpt('max_stacks_per_tenant',
default=100,
help=_('Maximum number of stacks any one tenant may have'
' active at one time.')),
default=512,
help=_('Maximum number of stacks any one tenant may have '
'active at one time. -1 stands for unlimited.')),
cfg.IntOpt('action_retry_limit',
default=5,
help=_('Number of times to retry to bring a '

View File

@ -682,7 +682,8 @@ class EngineService(service.ServiceBase):
# Do not stack limit check for admin since admin can see all stacks.
if not cnxt.is_admin:
tenant_limit = cfg.CONF.max_stacks_per_tenant
if stack_object.Stack.count_all(cnxt) >= tenant_limit:
if (tenant_limit >= 0 and
stack_object.Stack.count_all(cnxt) >= tenant_limit):
message = _("You have reached the maximum stacks per tenant, "
"%d. Please delete some stacks.") % tenant_limit
raise exception.RequestLimitExceeded(message=message)