Resource Quota - Add config option to limit clusters
Adding config option to limit the max number of clusters allowed per project. This limit is ignored if there is an explicit hard limit set for a project in the 'quotas' table. Change-Id: I8a904de156c10c210e9e72999cdcbc28e374ea71 Partially-Implements: blueprint resource-quota
This commit is contained in:
parent
203ce78b7a
commit
73059c5c20
@ -33,6 +33,7 @@ from magnum.conf import magnum_client
|
||||
from magnum.conf import neutron
|
||||
from magnum.conf import nova
|
||||
from magnum.conf import paths
|
||||
from magnum.conf import quota
|
||||
from magnum.conf import rpc
|
||||
from magnum.conf import services
|
||||
from magnum.conf import trust
|
||||
@ -59,6 +60,7 @@ magnum_client.register_opts(CONF)
|
||||
neutron.register_opts(CONF)
|
||||
nova.register_opts(CONF)
|
||||
paths.register_opts(CONF)
|
||||
quota.register_opts(CONF)
|
||||
rpc.register_opts(CONF)
|
||||
services.register_opts(CONF)
|
||||
trust.register_opts(CONF)
|
||||
|
38
magnum/conf/quota.py
Normal file
38
magnum/conf/quota.py
Normal file
@ -0,0 +1,38 @@
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
# use this file except in compliance with the License. You may obtain a copy
|
||||
# of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
from magnum.i18n import _
|
||||
|
||||
quotas_group = cfg.OptGroup(name='quotas',
|
||||
title='Options for quota configuration')
|
||||
|
||||
quotas_def_opts = [
|
||||
cfg.IntOpt('max_clusters_per_project',
|
||||
default=20,
|
||||
help=_('Max number of clusters allowed per project. Admin can '
|
||||
'override this default quota for a project by setting '
|
||||
'explicit limit in quotas DB table (using /quotas REST '
|
||||
'API endpoint).')),
|
||||
]
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_group(quotas_group)
|
||||
conf.register_opts(quotas_def_opts, group=quotas_group)
|
||||
|
||||
|
||||
def list_opts():
|
||||
return {
|
||||
quotas_group: quotas_def_opts
|
||||
}
|
Loading…
Reference in New Issue
Block a user