Merge "Centralize Config Options - patch merge, cleanup"

This commit is contained in:
Jenkins 2016-08-25 22:45:54 +00:00 committed by Gerrit Code Review
commit bc330c934b
12 changed files with 78 additions and 103 deletions

View File

@ -16,10 +16,10 @@
from oslo_config import cfg
from ironic.conf import agent
from ironic.conf import amt
from ironic.conf import api
from ironic.conf import audit
from ironic.conf import cimc
from ironic.conf import cisco_ucs
from ironic.conf import cisco
from ironic.conf import conductor
from ironic.conf import console
from ironic.conf import database
@ -49,10 +49,10 @@ from ironic.conf import virtualbox
CONF = cfg.CONF
agent.register_opts(CONF)
amt.register_opts(CONF)
api.register_opts(CONF)
audit.register_opts(CONF)
cimc.register_opts(CONF)
cisco_ucs.register_opts(CONF)
cisco.register_opts(CONF)
conductor.register_opts(CONF)
console.register_opts(CONF)
database.register_opts(CONF)

48
ironic/conf/amt.py Normal file
View File

@ -0,0 +1,48 @@
# Copyright 2016 Intel Corporation
# Copyright (c) 2012 NTT DOCOMO, INC.
# 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 ironic.common.i18n import _
opts = [
cfg.StrOpt('protocol',
default='http',
choices=['http', 'https'],
help=_('Protocol used for AMT endpoint')),
cfg.IntOpt('awake_interval',
default=60,
min=0,
help=_('Time interval (in seconds) for successive awake call '
'to AMT interface, this depends on the IdleTimeout '
'setting on AMT interface. AMT Interface will go to '
'sleep after 60 seconds of inactivity by default. '
'IdleTimeout=0 means AMT will not go to sleep at all. '
'Setting awake_interval=0 will disable awake call.')),
cfg.IntOpt('max_attempts',
default=3,
help=_('Maximum number of times to attempt an AMT operation, '
'before failing')),
cfg.IntOpt('action_wait',
default=10,
help=_('Amount of time (in seconds) to wait, before retrying '
'an AMT operation'))
]
def register_opts(conf):
conf.register_opts(opts, group='amt')

View File

@ -17,7 +17,9 @@ from oslo_config import cfg
from ironic.common.i18n import _
opts = [
# NOTE: options for CIMC (Cisco Integrated Management Controller), which talks
# to UCS (Unified Computing System) in standalone mode
cimc_opts = [
cfg.IntOpt('max_retry',
default=6,
help=_('Number of times a power operation needs to be '
@ -28,6 +30,20 @@ opts = [
'operations')),
]
# NOTE: options for UCSM (UCS Manager), which talks to UCS via a centralized
# management controller
ucsm_opts = [
cfg.IntOpt('max_retry',
default=6,
help=_('Number of times a power operation needs to be '
'retried')),
cfg.IntOpt('action_interval',
default=5,
help=_('Amount of time in seconds to wait in between power '
'operations')),
]
def register_opts(conf):
conf.register_opts(opts, group='cimc')
conf.register_opts(cimc_opts, group='cimc')
conf.register_opts(ucsm_opts, group='cisco_ucs')

View File

@ -1,33 +0,0 @@
# 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=5,
help=_('Amount of time in seconds to wait in between power '
'operations')),
]
def register_opts(conf):
conf.register_opts(opts, group='cisco_ucs')

View File

@ -12,8 +12,7 @@
import itertools
import ironic.drivers.modules.amt.common
import ironic.drivers.modules.amt.power
import ironic.conf
_default_opt_lists = [
ironic.conf.default.api_opts,
@ -32,13 +31,11 @@ _default_opt_lists = [
_opts = [
('DEFAULT', itertools.chain(*_default_opt_lists)),
('agent', ironic.conf.agent.opts),
('amt', itertools.chain(
ironic.drivers.modules.amt.common.opts,
ironic.drivers.modules.amt.power.opts)),
('amt', ironic.conf.amt.opts),
('api', ironic.conf.api.opts),
('audit', ironic.conf.audit.opts),
('cimc', ironic.conf.cimc.opts),
('cisco_ucs', ironic.conf.cisco_ucs.opts),
('cimc', ironic.conf.cisco.cimc_opts),
('cisco_ucs', ironic.conf.cisco.ucsm_opts),
('conductor', ironic.conf.conductor.opts),
('console', ironic.conf.console.opts),
('database', ironic.conf.database.opts),

View File

@ -20,7 +20,6 @@ import collections
import datetime
import threading
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy import utils as db_utils
@ -36,13 +35,10 @@ from ironic.common import exception
from ironic.common.i18n import _, _LW
from ironic.common import states
from ironic.common import utils
from ironic.conf import CONF
from ironic.db import api
from ironic.db.sqlalchemy import models
CONF = cfg.CONF
CONF.import_opt('heartbeat_timeout',
'ironic.conductor.manager',
group='conductor')
LOG = log.getLogger(__name__)

View File

@ -17,7 +17,6 @@ import time
from xml import etree
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
import six
@ -26,6 +25,7 @@ from ironic.common import boot_devices
from ironic.common import exception
from ironic.common.i18n import _, _LE
from ironic.common import utils
from ironic.conf import CONF
pywsman = importutils.try_import('pywsman')
@ -46,28 +46,6 @@ OPTIONAL_PROPERTIES = {
COMMON_PROPERTIES = REQUIRED_PROPERTIES.copy()
COMMON_PROPERTIES.update(OPTIONAL_PROPERTIES)
opts = [
cfg.StrOpt('protocol',
default='http',
choices=['http', 'https'],
help=_('Protocol used for AMT endpoint')),
cfg.IntOpt('awake_interval',
default=60,
min=0,
help=_('Time interval (in seconds) for successive awake call '
'to AMT interface, this depends on the IdleTimeout '
'setting on AMT interface. AMT Interface will go to '
'sleep after 60 seconds of inactivity by default. '
'IdleTimeout=0 means AMT will not go to sleep at all. '
'Setting awake_interval=0 will disable awake call.')),
]
CONF = cfg.CONF
opt_group = cfg.OptGroup(name='amt',
title='Options for the AMT power driver')
CONF.register_group(opt_group)
CONF.register_opts(opts, opt_group)
# TODO(lintan): More boot devices are supported by AMT, but not useful
# currently. Add them in the future.
BOOT_DEVICES_MAPPING = {

View File

@ -16,7 +16,6 @@ AMT Power Driver
"""
import copy
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import loopingcall
from oslo_utils import excutils
@ -26,26 +25,13 @@ from ironic.common import exception
from ironic.common.i18n import _, _LE, _LI, _LW
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.amt import common as amt_common
from ironic.drivers.modules.amt import resource_uris
pywsman = importutils.try_import('pywsman')
opts = [
cfg.IntOpt('max_attempts',
default=3,
help=_('Maximum number of times to attempt an AMT operation, '
'before failing')),
cfg.IntOpt('action_wait',
default=10,
help=_('Amount of time (in seconds) to wait, before retrying '
'an AMT operation'))
]
CONF = cfg.CONF
CONF.register_opts(opts, group='amt')
LOG = logging.getLogger(__name__)
AMT_POWER_MAP = {

View File

@ -35,9 +35,6 @@ from ironic.drivers.modules import pxe
LOG = logging.getLogger(__name__)
CONF.import_opt('pxe_append_params', 'ironic.drivers.modules.iscsi_deploy',
group='pxe')
def _prepare_agent_vmedia_boot(task):
"""Ejects virtual media devices and prepares for vmedia boot."""

View File

@ -31,8 +31,6 @@ from ironic.drivers import base
LOG = logging.getLogger(__name__)
CONF.import_opt('auth_strategy', 'ironic.api.app')
client = importutils.try_import('ironic_inspector_client')

View File

@ -39,7 +39,6 @@ import time
from ironic_lib import metrics_utils
from ironic_lib import utils as ironic_utils
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import loopingcall
from oslo_utils import excutils
@ -52,20 +51,13 @@ from ironic.common.i18n import _, _LE, _LI, _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.modules import deploy_utils
from ironic.drivers import utils as driver_utils
CONF = cfg.CONF
CONF.import_opt('retry_timeout',
'ironic.drivers.modules.ipminative',
group='ipmi')
CONF.import_opt('min_command_interval',
'ironic.drivers.modules.ipminative',
group='ipmi')
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)

View File