Centralize config options - [cimc]

Nova style refactor of config options in Ironic.

Change-Id: Id64f4919d70293fa61226651a3ec40257d91e73e
Partial-Bug: #1561100
This commit is contained in:
Ramamani Yeleswarapu 2016-03-22 09:24:41 -07:00
parent 5f59a264c5
commit 921bca203f
4 changed files with 37 additions and 17 deletions

View File

@ -15,8 +15,10 @@
from oslo_config import cfg
from ironic.conf import cimc
from ironic.conf import console
CONF = cfg.CONF
cimc.register_opts(CONF)
console.register_opts(CONF)

33
ironic/conf/cimc.py Normal file
View File

@ -0,0 +1,33 @@
# Copyright 2016 Intel Corporation
# Copyright 2015, Cisco Systems.
#
# 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 ironic.common.i18n import _
opts = [
cfg.IntOpt('max_retry',
default=6,
help=_('Number of times a power operation needs to be '
'retried')),
cfg.IntOpt('action_interval',
default=10,
help=_('Amount of time in seconds to wait in between power '
'operations')),
]
def register_opts(conf):
conf.register_opts(opts, group='cimc')

View File

@ -35,7 +35,6 @@ import ironic.drivers.modules.agent_base_vendor
import ironic.drivers.modules.agent_client
import ironic.drivers.modules.amt.common
import ironic.drivers.modules.amt.power
import ironic.drivers.modules.cimc.power
import ironic.drivers.modules.deploy_utils
import ironic.drivers.modules.iboot
import ironic.drivers.modules.ilo.common
@ -80,7 +79,7 @@ _opts = [
ironic.drivers.modules.amt.common.opts,
ironic.drivers.modules.amt.power.opts)),
('api', ironic.api.API_SERVICE_OPTS),
('cimc', ironic.drivers.modules.cimc.power.opts),
('cimc', ironic.conf.cimc.opts),
('cisco_ucs', ironic.drivers.modules.ucs.power.opts),
('conductor', itertools.chain(
ironic.conductor.base_manager.conductor_opts,

View File

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from oslo_config import cfg
from oslo_service import loopingcall
from oslo_utils import importutils
@ -20,25 +19,12 @@ from ironic.common import exception
from ironic.common.i18n import _
from ironic.common import states
from ironic.conductor import task_manager
from ironic.conf import CONF
from ironic.drivers import base
from ironic.drivers.modules.cimc import common
imcsdk = importutils.try_import('ImcSdk')
opts = [
cfg.IntOpt('max_retry',
default=6,
help=_('Number of times a power operation needs to be '
'retried')),
cfg.IntOpt('action_interval',
default=10,
help=_('Amount of time in seconds to wait in between power '
'operations')),
]
CONF = cfg.CONF
CONF.register_opts(opts, group='cimc')
if imcsdk:
CIMC_TO_IRONIC_POWER_STATE = {