Move quota opts to separated file
Currently we define quota opts in conf/api.py, move it out to a separated file to be more clear. Change-Id: I23feb9b54b288b872446680c2abf9b8e27f31b87
This commit is contained in:
@@ -23,6 +23,7 @@ from mogan.conf import glance
|
||||
from mogan.conf import ironic
|
||||
from mogan.conf import keystone
|
||||
from mogan.conf import neutron
|
||||
from mogan.conf import quota
|
||||
from mogan.conf import scheduler
|
||||
|
||||
CONF = cfg.CONF
|
||||
@@ -35,4 +36,5 @@ glance.register_opts(CONF)
|
||||
ironic.register_opts(CONF)
|
||||
keystone.register_opts(CONF)
|
||||
neutron.register_opts(CONF)
|
||||
quota.register_opts(CONF)
|
||||
scheduler.register_opts(CONF)
|
||||
|
||||
@@ -62,27 +62,7 @@ opts = [
|
||||
opt_group = cfg.OptGroup(name='api',
|
||||
title='Options for the mogan-api service')
|
||||
|
||||
quota_opts = [
|
||||
cfg.StrOpt('quota_driver',
|
||||
help=_("Specify the quota driver which is used in Mogan "
|
||||
"service.")),
|
||||
cfg.IntOpt('reservation_expire',
|
||||
default=86400,
|
||||
help=_('Number of seconds until a reservation expires')),
|
||||
cfg.IntOpt('until_refresh',
|
||||
default=0,
|
||||
help=_('Count of reservations until usage is refreshed')),
|
||||
cfg.IntOpt('max_age',
|
||||
default=0,
|
||||
help=_('Number of seconds between subsequent usage refreshes')),
|
||||
]
|
||||
|
||||
opt_quota_group = cfg.OptGroup(name='quota',
|
||||
title='Options for the mogan quota')
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_group(opt_group)
|
||||
conf.register_opts(opts, group=opt_group)
|
||||
conf.register_group(opt_quota_group)
|
||||
conf.register_opts(quota_opts, group=opt_quota_group)
|
||||
|
||||
@@ -20,6 +20,7 @@ import mogan.conf.glance
|
||||
import mogan.conf.ironic
|
||||
import mogan.conf.keystone
|
||||
import mogan.conf.neutron
|
||||
import mogan.conf.quota
|
||||
import mogan.conf.scheduler
|
||||
|
||||
_default_opt_lists = [
|
||||
@@ -38,6 +39,7 @@ _opts = [
|
||||
('ironic', mogan.conf.ironic.opts),
|
||||
('keystone', mogan.conf.keystone.opts),
|
||||
('neutron', mogan.conf.neutron.opts),
|
||||
('quota', mogan.conf.quota.opts),
|
||||
('scheduler', mogan.conf.scheduler.opts),
|
||||
]
|
||||
|
||||
|
||||
42
mogan/conf/quota.py
Normal file
42
mogan/conf/quota.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# Copyright 2017 Huawei Technologies Co.,LTD.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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 mogan.common.i18n import _
|
||||
|
||||
|
||||
quota_opts = [
|
||||
cfg.StrOpt('quota_driver',
|
||||
help=_("Specify the quota driver which is used in Mogan "
|
||||
"service.")),
|
||||
cfg.IntOpt('reservation_expire',
|
||||
default=86400,
|
||||
help=_('Number of seconds until a reservation expires')),
|
||||
cfg.IntOpt('until_refresh',
|
||||
default=0,
|
||||
help=_('Count of reservations until usage is refreshed')),
|
||||
cfg.IntOpt('max_age',
|
||||
default=0,
|
||||
help=_('Number of seconds between subsequent usage refreshes')),
|
||||
]
|
||||
|
||||
opt_quota_group = cfg.OptGroup(name='quota',
|
||||
title='Options for the mogan quota')
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_group(opt_quota_group)
|
||||
conf.register_opts(quota_opts, group=opt_quota_group)
|
||||
Reference in New Issue
Block a user