diff --git a/ironic/conf/__init__.py b/ironic/conf/__init__.py index df6a81ac9f..4bcb973199 100644 --- a/ironic/conf/__init__.py +++ b/ironic/conf/__init__.py @@ -22,6 +22,7 @@ from ironic.conf import conductor from ironic.conf import console from ironic.conf import database from ironic.conf import default +from ironic.conf import deploy from ironic.conf import dhcp from ironic.conf import glance from ironic.conf import iboot @@ -47,6 +48,7 @@ conductor.register_opts(CONF) console.register_opts(CONF) database.register_opts(CONF) default.register_opts(CONF) +deploy.register_opts(CONF) dhcp.register_opts(CONF) glance.register_opts(CONF) iboot.register_opts(CONF) diff --git a/ironic/conf/deploy.py b/ironic/conf/deploy.py new file mode 100644 index 0000000000..d033ea23d5 --- /dev/null +++ b/ironic/conf/deploy.py @@ -0,0 +1,68 @@ +# 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('http_url', + help=_("ironic-conductor node's HTTP server URL. " + "Example: http://192.1.2.3:8080")), + cfg.StrOpt('http_root', + default='/httpboot', + help=_("ironic-conductor node's HTTP root path.")), + cfg.IntOpt('erase_devices_priority', + help=_('Priority to run in-band erase devices via the Ironic ' + 'Python Agent ramdisk. If unset, will use the priority ' + 'set in the ramdisk (defaults to 10 for the ' + 'GenericHardwareManager). If set to 0, will not run ' + 'during cleaning.')), + # TODO(mmitchell): Remove the deprecated name/group during Ocata cycle. + cfg.IntOpt('shred_random_overwrite_iterations', + deprecated_name='erase_devices_iterations', + deprecated_group='deploy', + default=1, + min=0, + help=_('During shred, overwrite all block devices N times with ' + 'random data. This is only used if a device could not ' + 'be ATA Secure Erased. Defaults to 1.')), + cfg.BoolOpt('shred_final_overwrite_with_zeros', + default=True, + help=_("Whether to write zeros to a node's block devices " + "after writing random data. This will write zeros to " + "the device even when " + "deploy.shred_random_overwrite_interations is 0. This " + "option is only used if a device could not be ATA " + "Secure Erased. Defaults to True.")), + cfg.BoolOpt('continue_if_disk_secure_erase_fails', + default=False, + help=_('Defines what to do if an ATA secure erase operation ' + 'fails during cleaning in the Ironic Python Agent. ' + 'If False, the cleaning operation will fail and the ' + 'node will be put in ``clean failed`` state. ' + 'If True, shred will be invoked and cleaning will ' + 'continue.')), + cfg.BoolOpt('power_off_after_deploy_failure', + default=True, + help=_('Whether to power off a node after deploy failure. ' + 'Defaults to True.')), +] + + +def register_opts(conf): + conf.register_opts(opts, group='deploy') diff --git a/ironic/conf/opts.py b/ironic/conf/opts.py index 9458a2bfe5..b1c105f481 100644 --- a/ironic/conf/opts.py +++ b/ironic/conf/opts.py @@ -17,7 +17,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.deploy_utils import ironic.drivers.modules.iscsi_deploy import ironic.drivers.modules.pxe @@ -49,7 +48,7 @@ _opts = [ ('conductor', ironic.conf.conductor.opts), ('console', ironic.conf.console.opts), ('database', ironic.conf.database.opts), - ('deploy', ironic.drivers.modules.deploy_utils.deploy_opts), + ('deploy', ironic.conf.deploy.opts), ('dhcp', ironic.conf.dhcp.opts), ('glance', ironic.conf.glance.opts), ('iboot', ironic.conf.iboot.opts), diff --git a/ironic/drivers/modules/deploy_utils.py b/ironic/drivers/modules/deploy_utils.py index 87aaf65de1..e7456f5826 100644 --- a/ironic/drivers/modules/deploy_utils.py +++ b/ironic/drivers/modules/deploy_utils.py @@ -21,7 +21,6 @@ import time from ironic_lib import disk_utils from oslo_concurrency import processutils -from oslo_config import cfg from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import excutils @@ -40,58 +39,13 @@ from ironic.common import keystone from ironic.common import states from ironic.common import utils from ironic.conductor import utils as manager_utils +from ironic.conf import CONF from ironic.drivers.modules import agent_client from ironic.drivers.modules import image_cache from ironic.drivers import utils as driver_utils from ironic import objects -deploy_opts = [ - cfg.StrOpt('http_url', - help=_("ironic-conductor node's HTTP server URL. " - "Example: http://192.1.2.3:8080")), - cfg.StrOpt('http_root', - default='/httpboot', - help=_("ironic-conductor node's HTTP root path.")), - cfg.IntOpt('erase_devices_priority', - help=_('Priority to run in-band erase devices via the Ironic ' - 'Python Agent ramdisk. If unset, will use the priority ' - 'set in the ramdisk (defaults to 10 for the ' - 'GenericHardwareManager). If set to 0, will not run ' - 'during cleaning.')), - # TODO(mmitchell): Remove the deprecated name/group during Ocata cycle. - cfg.IntOpt('shred_random_overwrite_iterations', - deprecated_name='erase_devices_iterations', - deprecated_group='deploy', - default=1, - min=0, - help=_('During shred, overwrite all block devices N times with ' - 'random data. This is only used if a device could not ' - 'be ATA Secure Erased. Defaults to 1.')), - cfg.BoolOpt('shred_final_overwrite_with_zeros', - default=True, - help=_("Whether to write zeros to a node's block devices " - "after writing random data. This will write zeros to " - "the device even when " - "deploy.shred_random_overwrite_interations is 0. This " - "option is only used if a device could not be ATA " - "Secure Erased. Defaults to True.")), - cfg.BoolOpt('continue_if_disk_secure_erase_fails', - default=False, - help=_('Defines what to do if an ATA secure erase operation ' - 'fails during cleaning in the Ironic Python Agent. ' - 'If False, the cleaning operation will fail and the ' - 'node will be put in ``clean failed`` state. ' - 'If True, shred will be invoked and cleaning will ' - 'continue.')), - cfg.BoolOpt('power_off_after_deploy_failure', - default=True, - help=_('Whether to power off a node after deploy failure. ' - 'Defaults to True.')), -] -CONF = cfg.CONF -CONF.register_opts(deploy_opts, group='deploy') - # TODO(Faizan): Move this logic to common/utils.py and deprecate # rootwrap_config. # This is required to set the default value of ironic_lib option