Centralize config options - [ipmi]

Nova style refactor of config options in Ironic.

Change-Id: I3ca346cca5161baeaefc1f976ae5ec38c0122eab
Partial-Bug: #1561100
This commit is contained in:
Ramamani Yeleswarapu 2016-04-05 16:12:02 -07:00
parent fffd741769
commit 700ad0567b
4 changed files with 46 additions and 23 deletions

View File

@ -24,6 +24,7 @@ from ironic.conf import dhcp
from ironic.conf import iboot
from ironic.conf import ilo
from ironic.conf import inspector
from ironic.conf import ipmi
CONF = cfg.CONF
@ -36,3 +37,4 @@ dhcp.register_opts(CONF)
iboot.register_opts(CONF)
ilo.register_opts(CONF)
inspector.register_opts(CONF)
ipmi.register_opts(CONF)

42
ironic/conf/ipmi.py Normal file
View File

@ -0,0 +1,42 @@
# Copyright 2016 Intel Corporation
#
# Copyright 2013 International Business Machines Corporation
# All Rights Reserved.
# 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('retry_timeout',
default=60,
help=_('Maximum time in seconds to retry IPMI operations. '
'There is a tradeoff when setting this value. Setting '
'this too low may cause older BMCs to crash and require '
'a hard reset. However, setting too high can cause the '
'sync power state periodic task to hang when there are '
'slow or unresponsive BMCs.')),
cfg.IntOpt('min_command_interval',
default=5,
help=_('Minimum time, in seconds, between IPMI operations '
'sent to a server. There is a risk with some hardware '
'that setting this too low may cause the BMC to crash. '
'Recommended setting is 5 seconds.')),
]
def register_opts(conf):
conf.register_opts(opts, group='ipmi')

View File

@ -33,7 +33,6 @@ import ironic.drivers.modules.amt.common
import ironic.drivers.modules.amt.power
import ironic.drivers.modules.deploy_utils
import ironic.drivers.modules.image_cache
import ironic.drivers.modules.ipminative
import ironic.drivers.modules.irmc.boot
import ironic.drivers.modules.irmc.common
import ironic.drivers.modules.iscsi_deploy
@ -81,7 +80,7 @@ _opts = [
('iboot', ironic.conf.iboot.opts),
('ilo', ironic.conf.ilo.opts),
('inspector', ironic.conf.inspector.opts),
('ipmi', ironic.drivers.modules.ipminative.opts),
('ipmi', ironic.conf.ipmi.opts),
('irmc', itertools.chain(
ironic.drivers.modules.irmc.boot.opts,
ironic.drivers.modules.irmc.common.opts)),

View File

@ -22,7 +22,6 @@ Ironic Native IPMI power manager.
import os
from ironic_lib import utils as ironic_utils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
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
from ironic.drivers import utils as driver_utils
@ -45,26 +45,6 @@ if pyghmi:
from pyghmi import exceptions as pyghmi_exception
from pyghmi.ipmi import command as ipmi_command
opts = [
cfg.IntOpt('retry_timeout',
default=60,
help=_('Maximum time in seconds to retry IPMI operations. '
'There is a tradeoff when setting this value. Setting '
'this too low may cause older BMCs to crash and require '
'a hard reset. However, setting too high can cause the '
'sync power state periodic task to hang when there are '
'slow or unresponsive BMCs.')),
cfg.IntOpt('min_command_interval',
default=5,
help=_('Minimum time, in seconds, between IPMI operations '
'sent to a server. There is a risk with some hardware '
'that setting this too low may cause the BMC to crash. '
'Recommended setting is 5 seconds.')),
]
CONF = cfg.CONF
CONF.register_opts(opts, group='ipmi')
LOG = logging.getLogger(__name__)
REQUIRED_PROPERTIES = {'ipmi_address': _("IP of the node's BMC. Required."),