Merge "Centralize config options - [agent]"

This commit is contained in:
Jenkins 2016-07-30 00:20:22 +00:00 committed by Gerrit Code Review
commit c35ba34707
6 changed files with 73 additions and 70 deletions

View File

@ -15,6 +15,7 @@
from oslo_config import cfg from oslo_config import cfg
from ironic.conf import agent
from ironic.conf import api from ironic.conf import api
from ironic.conf import cimc from ironic.conf import cimc
from ironic.conf import cisco_ucs from ironic.conf import cisco_ucs
@ -41,6 +42,7 @@ from ironic.conf import virtualbox
CONF = cfg.CONF CONF = cfg.CONF
agent.register_opts(CONF)
api.register_opts(CONF) api.register_opts(CONF)
cimc.register_opts(CONF) cimc.register_opts(CONF)
cisco_ucs.register_opts(CONF) cisco_ucs.register_opts(CONF)

67
ironic/conf/agent.py Normal file
View File

@ -0,0 +1,67 @@
# Copyright 2016 Intel Corporation
# Copyright 2014 Rackspace, Inc.
# Copyright 2015 Red Hat, Inc.
#
# 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.BoolOpt('manage_agent_boot',
default=True,
help=_('Whether Ironic will manage booting of the agent '
'ramdisk. If set to False, you will need to configure '
'your mechanism to allow booting the agent '
'ramdisk.')),
cfg.IntOpt('memory_consumed_by_agent',
default=0,
help=_('The memory size in MiB consumed by agent when it is '
'booted on a bare metal node. This is used for '
'checking if the image can be downloaded and deployed '
'on the bare metal node after booting agent ramdisk. '
'This may be set according to the memory consumed by '
'the agent ramdisk image.')),
cfg.BoolOpt('stream_raw_images',
default=True,
help=_('Whether the agent ramdisk should stream raw images '
'directly onto the disk or not. By streaming raw '
'images directly onto the disk the agent ramdisk will '
'not spend time copying the image to a tmpfs partition '
'(therefore consuming less memory) prior to writing it '
'to the disk. Unless the disk where the image will be '
'copied to is really slow, this option should be set '
'to True. Defaults to True.')),
cfg.IntOpt('heartbeat_timeout',
default=300,
help=_('Maximum interval (in seconds) for agent heartbeats.')),
cfg.IntOpt('post_deploy_get_power_state_retries',
default=6,
help=_('Number of times to retry getting power state to check '
'if bare metal node has been powered off after a soft '
'power off.')),
cfg.IntOpt('post_deploy_get_power_state_retry_interval',
default=5,
help=_('Amount of time (in seconds) to wait between polling '
'power state after trigger soft poweroff.')),
cfg.StrOpt('agent_api_version',
default='v1',
help=_('API version to use for communicating with the ramdisk '
'agent.'))
]
def register_opts(conf):
conf.register_opts(opts, group='agent')

View File

@ -12,9 +12,6 @@
import itertools import itertools
import ironic.drivers.modules.agent
import ironic.drivers.modules.agent_base_vendor
import ironic.drivers.modules.agent_client
import ironic.drivers.modules.amt.common import ironic.drivers.modules.amt.common
import ironic.drivers.modules.amt.power import ironic.drivers.modules.amt.power
import ironic.drivers.modules.iscsi_deploy import ironic.drivers.modules.iscsi_deploy
@ -35,10 +32,7 @@ _default_opt_lists = [
_opts = [ _opts = [
('DEFAULT', itertools.chain(*_default_opt_lists)), ('DEFAULT', itertools.chain(*_default_opt_lists)),
('agent', itertools.chain( ('agent', ironic.conf.agent.opts),
ironic.drivers.modules.agent.agent_opts,
ironic.drivers.modules.agent_base_vendor.agent_opts,
ironic.drivers.modules.agent_client.agent_opts)),
('amt', itertools.chain( ('amt', itertools.chain(
ironic.drivers.modules.amt.common.opts, ironic.drivers.modules.amt.common.opts,
ironic.drivers.modules.amt.power.opts)), ironic.drivers.modules.amt.power.opts)),

View File

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo_config import cfg
from oslo_log import log from oslo_log import log
from oslo_utils import excutils from oslo_utils import excutils
from oslo_utils import units from oslo_utils import units
@ -32,43 +31,12 @@ from ironic.common import states
from ironic.common import utils from ironic.common import utils
from ironic.conductor import task_manager from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils from ironic.conductor import utils as manager_utils
from ironic.conf import CONF
from ironic.drivers import base from ironic.drivers import base
from ironic.drivers.modules import agent_base_vendor from ironic.drivers.modules import agent_base_vendor
from ironic.drivers.modules import deploy_utils from ironic.drivers.modules import deploy_utils
agent_opts = [
cfg.BoolOpt('manage_agent_boot',
default=True,
help=_('Whether Ironic will manage booting of the agent '
'ramdisk. If set to False, you will need to configure '
'your mechanism to allow booting the agent '
'ramdisk.')),
cfg.IntOpt('memory_consumed_by_agent',
default=0,
help=_('The memory size in MiB consumed by agent when it is '
'booted on a bare metal node. This is used for '
'checking if the image can be downloaded and deployed '
'on the bare metal node after booting agent ramdisk. '
'This may be set according to the memory consumed by '
'the agent ramdisk image.')),
cfg.BoolOpt('stream_raw_images',
default=True,
help=_('Whether the agent ramdisk should stream raw images '
'directly onto the disk or not. By streaming raw '
'images directly onto the disk the agent ramdisk will '
'not spend time copying the image to a tmpfs partition '
'(therefore consuming less memory) prior to writing it '
'to the disk. Unless the disk where the image will be '
'copied to is really slow, this option should be set '
'to True. Defaults to True.')),
]
CONF = cfg.CONF
CONF.import_opt('erase_devices_priority',
'ironic.drivers.modules.deploy_utils', group='deploy')
CONF.register_opts(agent_opts, group='agent')
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)

View File

@ -20,7 +20,6 @@ import ast
import collections import collections
import time import time
from oslo_config import cfg
from oslo_log import log from oslo_log import log
from oslo_utils import excutils from oslo_utils import excutils
from oslo_utils import strutils from oslo_utils import strutils
@ -38,29 +37,12 @@ from ironic.common import utils
from ironic.conductor import rpcapi from ironic.conductor import rpcapi
from ironic.conductor import task_manager from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils from ironic.conductor import utils as manager_utils
from ironic.conf import CONF
from ironic.drivers import base from ironic.drivers import base
from ironic.drivers.modules import agent_client from ironic.drivers.modules import agent_client
from ironic.drivers.modules import deploy_utils from ironic.drivers.modules import deploy_utils
from ironic import objects from ironic import objects
agent_opts = [
cfg.IntOpt('heartbeat_timeout',
default=300,
help=_('Maximum interval (in seconds) for agent heartbeats.')),
cfg.IntOpt('post_deploy_get_power_state_retries',
default=6,
help=_('Number of times to retry getting power state to check '
'if bare metal node has been powered off after a soft '
'power off.')),
cfg.IntOpt('post_deploy_get_power_state_retry_interval',
default=5,
help=_('Amount of time (in seconds) to wait between polling '
'power state after trigger soft poweroff.')),
]
CONF = cfg.CONF
CONF.register_opts(agent_opts, group='agent')
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)
# This contains a nested dictionary containing the post clean step # This contains a nested dictionary containing the post clean step

View File

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from oslo_config import cfg
from oslo_log import log from oslo_log import log
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import requests import requests
@ -21,16 +20,7 @@ from ironic.common import exception
from ironic.common.i18n import _ from ironic.common.i18n import _
from ironic.common.i18n import _LE from ironic.common.i18n import _LE
from ironic.common.i18n import _LW from ironic.common.i18n import _LW
from ironic.conf import CONF
agent_opts = [
cfg.StrOpt('agent_api_version',
default='v1',
help=_('API version to use for communicating with the ramdisk '
'agent.'))
]
CONF = cfg.CONF
CONF.register_opts(agent_opts, group='agent')
LOG = log.getLogger(__name__) LOG = log.getLogger(__name__)