Centralize config options - [seamicro]

Nova style refactor of config options in Ironic.

Change-Id: Ia8e38f448253b58ed63edd1c6aa64da324578cda
Partial-Bug: #1561100
This commit is contained in:
Ramamani Yeleswarapu 2016-04-07 16:33:43 -07:00
parent de43a33084
commit 31e80ab9bd
4 changed files with 38 additions and 18 deletions

View File

@ -28,6 +28,7 @@ from ironic.conf import ipmi
from ironic.conf import irmc
from ironic.conf import keystone
from ironic.conf import oneview
from ironic.conf import seamicro
CONF = cfg.CONF
@ -44,3 +45,4 @@ ipmi.register_opts(CONF)
irmc.register_opts(CONF)
keystone.register_opts(CONF)
oneview.register_opts(CONF)
seamicro.register_opts(CONF)

View File

@ -34,7 +34,6 @@ import ironic.drivers.modules.deploy_utils
import ironic.drivers.modules.image_cache
import ironic.drivers.modules.iscsi_deploy
import ironic.drivers.modules.pxe
import ironic.drivers.modules.seamicro
import ironic.drivers.modules.snmp
import ironic.drivers.modules.ssh
import ironic.drivers.modules.virtualbox
@ -85,7 +84,7 @@ _opts = [
('pxe', itertools.chain(
ironic.drivers.modules.iscsi_deploy.pxe_opts,
ironic.drivers.modules.pxe.pxe_opts)),
('seamicro', ironic.drivers.modules.seamicro.opts),
('seamicro', ironic.conf.seamicro.opts),
('snmp', ironic.drivers.modules.snmp.opts),
('ssh', ironic.drivers.modules.ssh.libvirt_opts),
('swift', ironic.common.swift.swift_opts),

34
ironic/conf/seamicro.py Normal file
View File

@ -0,0 +1,34 @@
# Copyright 2016 Intel Corporation
#
# 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=3,
help=_('Maximum retries for SeaMicro operations')),
cfg.IntOpt('action_timeout',
default=10,
help=_('Seconds to wait for power action to be completed'))
]
opt_group = cfg.OptGroup(name='seamicro',
title='Options for the seamicro power driver')
def register_opts(conf):
conf.register_group(opt_group)
conf.register_opts(opts, group=opt_group)

View File

@ -21,7 +21,6 @@ Provides vendor passthru methods for SeaMicro specific functionality.
import os
import re
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import loopingcall
from oslo_utils import importutils
@ -36,6 +35,7 @@ from ironic.common.i18n import _LW
from ironic.common import states
from ironic.common import utils
from ironic.conductor import task_manager
from ironic.conf import CONF
from ironic.drivers import base
from ironic.drivers.modules import console_utils
@ -44,21 +44,6 @@ if seamicroclient:
from seamicroclient import client as seamicro_client
from seamicroclient import exceptions as seamicro_client_exception
opts = [
cfg.IntOpt('max_retry',
default=3,
help=_('Maximum retries for SeaMicro operations')),
cfg.IntOpt('action_timeout',
default=10,
help=_('Seconds to wait for power action to be completed'))
]
CONF = cfg.CONF
opt_group = cfg.OptGroup(name='seamicro',
title='Options for the seamicro power driver')
CONF.register_group(opt_group)
CONF.register_opts(opts, opt_group)
LOG = logging.getLogger(__name__)
_BOOT_DEVICES_MAP = {