Merge "Centralize config options - [pxe]"

This commit is contained in:
Jenkins 2016-08-19 04:31:13 +00:00 committed by Gerrit Code Review
commit 44de0e0e69
5 changed files with 108 additions and 99 deletions

View File

@ -37,6 +37,7 @@ from ironic.conf import metrics
from ironic.conf import metrics_statsd
from ironic.conf import neutron
from ironic.conf import oneview
from ironic.conf import pxe
from ironic.conf import seamicro
from ironic.conf import service_catalog
from ironic.conf import snmp
@ -68,6 +69,7 @@ metrics.register_opts(CONF)
metrics_statsd.register_opts(CONF)
neutron.register_opts(CONF)
oneview.register_opts(CONF)
pxe.register_opts(CONF)
seamicro.register_opts(CONF)
service_catalog.register_opts(CONF)
snmp.register_opts(CONF)

View File

@ -15,7 +15,6 @@ import itertools
import ironic.drivers.modules.amt.common
import ironic.drivers.modules.amt.power
import ironic.drivers.modules.iscsi_deploy
import ironic.drivers.modules.pxe
_default_opt_lists = [
ironic.conf.default.api_opts,
@ -57,9 +56,7 @@ _opts = [
('metrics_statsd', ironic.conf.metrics_statsd.opts),
('neutron', ironic.conf.neutron.list_opts()),
('oneview', ironic.conf.oneview.opts),
('pxe', itertools.chain(
ironic.drivers.modules.iscsi_deploy.pxe_opts,
ironic.drivers.modules.pxe.pxe_opts)),
('pxe', ironic.conf.pxe.opts),
('seamicro', ironic.conf.seamicro.opts),
('service_catalog', ironic.conf.service_catalog.list_opts()),
('snmp', ironic.conf.snmp.opts),

103
ironic/conf/pxe.py Normal file
View File

@ -0,0 +1,103 @@
# Copyright 2016 Intel Corporation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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.
import os
from oslo_config import cfg
from ironic.common.i18n import _
opts = [
cfg.StrOpt('pxe_append_params',
default='nofb nomodeset vga=normal',
help=_('Additional append parameters for baremetal PXE boot.')),
cfg.StrOpt('default_ephemeral_format',
default='ext4',
help=_('Default file system format for ephemeral partition, '
'if one is created.')),
cfg.StrOpt('images_path',
default='/var/lib/ironic/images/',
help=_('On the ironic-conductor node, directory where images '
'are stored on disk.')),
cfg.StrOpt('instance_master_path',
default='/var/lib/ironic/master_images',
help=_('On the ironic-conductor node, directory where master '
'instance images are stored on disk. '
'Setting to <None> disables image caching.')),
cfg.IntOpt('image_cache_size',
default=20480,
help=_('Maximum size (in MiB) of cache for master images, '
'including those in use.')),
# 10080 here is 1 week - 60*24*7. It is entirely arbitrary in the absence
# of a facility to disable the ttl entirely.
cfg.IntOpt('image_cache_ttl',
default=10080,
help=_('Maximum TTL (in minutes) for old master images in '
'cache.')),
cfg.StrOpt('pxe_config_template',
default=os.path.join(
'$pybasedir', 'drivers/modules/pxe_config.template'),
help=_('On ironic-conductor node, template file for PXE '
'configuration.')),
cfg.StrOpt('uefi_pxe_config_template',
default=os.path.join(
'$pybasedir',
'drivers/modules/elilo_efi_pxe_config.template'),
help=_('On ironic-conductor node, template file for PXE '
'configuration for UEFI boot loader.')),
cfg.StrOpt('tftp_server',
default='$my_ip',
help=_("IP address of ironic-conductor node's TFTP server.")),
cfg.StrOpt('tftp_root',
default='/tftpboot',
help=_("ironic-conductor node's TFTP root path. The "
"ironic-conductor must have read/write access to this "
"path.")),
cfg.StrOpt('tftp_master_path',
default='/tftpboot/master_images',
help=_('On ironic-conductor node, directory where master TFTP '
'images are stored on disk. '
'Setting to <None> disables image caching.')),
# NOTE(dekehn): Additional boot files options may be created in the event
# other architectures require different boot files.
cfg.StrOpt('pxe_bootfile_name',
default='pxelinux.0',
help=_('Bootfile DHCP parameter.')),
cfg.StrOpt('uefi_pxe_bootfile_name',
default='elilo.efi',
help=_('Bootfile DHCP parameter for UEFI boot mode.')),
cfg.BoolOpt('ipxe_enabled',
default=False,
help=_('Enable iPXE boot.')),
cfg.StrOpt('ipxe_boot_script',
default=os.path.join(
'$pybasedir', 'drivers/modules/boot.ipxe'),
help=_('On ironic-conductor node, the path to the main iPXE '
'script file.')),
cfg.IntOpt('ipxe_timeout',
default=0,
help=_('Timeout value (in seconds) for downloading an image '
'via iPXE. Defaults to 0 (no timeout)')),
cfg.StrOpt('ip_version',
default='4',
choices=['4', '6'],
help=_('The IP version that will be used for PXE booting. '
'Defaults to 4. EXPERIMENTAL')),
]
def register_opts(conf):
conf.register_opts(opts, group='pxe')

View File

@ -30,6 +30,7 @@ from ironic.common import states
from ironic.common import utils
from ironic.conductor import task_manager
from ironic.conductor import utils as manager_utils
from ironic.conf import CONF
from ironic.drivers import base
from ironic.drivers.modules import agent_base_vendor
from ironic.drivers.modules import deploy_utils
@ -39,40 +40,6 @@ LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
# NOTE(rameshg87): This file now registers some of opts in pxe group.
# This is acceptable for now as a future refactoring into
# separate boot and deploy interfaces is planned, and moving config
# options twice is not recommended. Hence we would move the parameters
# to the appropriate place in the final refactoring.
pxe_opts = [
cfg.StrOpt('pxe_append_params',
default='nofb nomodeset vga=normal',
help=_('Additional append parameters for baremetal PXE boot.')),
cfg.StrOpt('default_ephemeral_format',
default='ext4',
help=_('Default file system format for ephemeral partition, '
'if one is created.')),
cfg.StrOpt('images_path',
default='/var/lib/ironic/images/',
help=_('On the ironic-conductor node, directory where images '
'are stored on disk.')),
cfg.StrOpt('instance_master_path',
default='/var/lib/ironic/master_images',
help=_('On the ironic-conductor node, directory where master '
'instance images are stored on disk. '
'Setting to <None> disables image caching.')),
cfg.IntOpt('image_cache_size',
default=20480,
help=_('Maximum size (in MiB) of cache for master images, '
'including those in use.')),
# 10080 here is 1 week - 60*24*7. It is entirely arbitrary in the absence
# of a facility to disable the ttl entirely.
cfg.IntOpt('image_cache_ttl',
default=10080,
help=_('Maximum TTL (in minutes) for old master images in '
'cache.')),
]
iscsi_opts = [
cfg.PortOpt('portal_port',
default=3260,
@ -80,8 +47,6 @@ iscsi_opts = [
'for incoming connections.')),
]
CONF = cfg.CONF
CONF.register_opts(pxe_opts, group='pxe')
CONF.register_opts(iscsi_opts, group='iscsi')
DISK_LAYOUT_PARAMS = ('root_gb', 'swap_mb', 'ephemeral_gb')

View File

@ -21,7 +21,6 @@ import shutil
from ironic_lib import metrics_utils
from ironic_lib import utils as ironic_utils
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import fileutils
@ -33,75 +32,18 @@ from ironic.common.i18n import _
from ironic.common.i18n import _LE
from ironic.common.i18n import _LW
from ironic.common import image_service as service
from ironic.common import paths
from ironic.common import pxe_utils
from ironic.common import states
from ironic.conf import CONF
from ironic.drivers import base
from ironic.drivers.modules import deploy_utils
from ironic.drivers.modules import image_cache
from ironic.drivers import utils as driver_utils
pxe_opts = [
cfg.StrOpt('pxe_config_template',
default=paths.basedir_def(
'drivers/modules/pxe_config.template'),
help=_('On ironic-conductor node, template file for PXE '
'configuration.')),
cfg.StrOpt('uefi_pxe_config_template',
default=paths.basedir_def(
'drivers/modules/elilo_efi_pxe_config.template'),
help=_('On ironic-conductor node, template file for PXE '
'configuration for UEFI boot loader.')),
cfg.StrOpt('tftp_server',
default='$my_ip',
help=_("IP address of ironic-conductor node's TFTP server.")),
cfg.StrOpt('tftp_root',
default='/tftpboot',
help=_("ironic-conductor node's TFTP root path. The "
"ironic-conductor must have read/write access to this "
"path.")),
cfg.StrOpt('tftp_master_path',
default='/tftpboot/master_images',
help=_('On ironic-conductor node, directory where master TFTP '
'images are stored on disk. '
'Setting to <None> disables image caching.')),
# NOTE(dekehn): Additional boot files options may be created in the event
# other architectures require different boot files.
cfg.StrOpt('pxe_bootfile_name',
default='pxelinux.0',
help=_('Bootfile DHCP parameter.')),
cfg.StrOpt('uefi_pxe_bootfile_name',
default='elilo.efi',
help=_('Bootfile DHCP parameter for UEFI boot mode.')),
cfg.BoolOpt('ipxe_enabled',
default=False,
help=_('Enable iPXE boot.')),
cfg.StrOpt('ipxe_boot_script',
default=paths.basedir_def(
'drivers/modules/boot.ipxe'),
help=_('On ironic-conductor node, the path to the main iPXE '
'script file.')),
cfg.IntOpt('ipxe_timeout',
default=0,
help=_('Timeout value (in seconds) for downloading an image '
'via iPXE. Defaults to 0 (no timeout)')),
cfg.StrOpt('ip_version',
default='4',
choices=['4', '6'],
help=_('The IP version that will be used for PXE booting. '
'Defaults to 4. EXPERIMENTAL')),
]
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
CONF = cfg.CONF
CONF.register_opts(pxe_opts, group='pxe')
CONF.import_opt('deploy_callback_timeout', 'ironic.conductor.manager',
group='conductor')
REQUIRED_PROPERTIES = {
'deploy_kernel': _("UUID (from Glance) of the deployment kernel. "
"Required."),