Clean up ipxe support

The puppet-ironic module's ipxe support does not align with current
versions of ironic which delineated ipxe and pxe support quite some
time ago.

This is an attempt to reconcile this.

Conflicts:
	manifests/pxe.pp

Backport notes:
- This change includes the following follow-up commits.

    Make ipxe bootfile name configurable
    commit d99a51d17b

    Fix incorrect handling/update about deprecated parameters
    commit b307c40f35

    Fix usage of ironic::pxe::common
    commit c21b1e8db6

- This change keeps default of uefi_ipxe_bootfile_name to ipxe.efi to
  be aligned with the default in ironic stable/wallaby (and older).

- The ip_version parameter is not depecated by this backport because
  the parameter is still valid.

- The change in default values were reverted as much as possible.

Conflicts:
	spec/classes/ironic_drivers_pxe_spec.rb

Backport notes for Ussuri:
- ipxe_enabled parameter is not deprecated in this backport because
  the parameter is still supported by ironic in Ussuri and older.

Change-Id: Ia30aff290ec24972f387612851f8f630ddc9403b
(cherry picked from commit 3864e15998)
(cherry picked from commit d7d0f7042e)
(cherry picked from commit cc46b445a8)
(cherry picked from commit 9847b3b90b)
This commit is contained in:
Julia Kreger 2021-06-23 08:32:56 -07:00 committed by Takashi Kajinami
parent d5535414d6
commit d060ed8fac
4 changed files with 99 additions and 36 deletions

View File

@ -26,18 +26,28 @@
# [*pxe_append_params*]
# (optional) Additional append parameters for baremetal PXE boot.
# Should be valid pxe parameters
# Defaults to $::os_service_default
# Defaults to $::os_service_default.
#
# [*pxe_bootfile_name*]
# (optional) Bootfile DHCP parameter.
# If not set, its value is detected based on ipxe_enabled.
# Defaults to undef.
# If not set, its value is detected.
# Defaults to $::os_service_default.
#
# [*pxe_config_template*]
# (optional) Template file for PXE configuration.
# If set, should be an valid template file. Otherwise, its value is detected
# based on ipxe_enabled.
# Defaults to undef.
# If set, should be an valid template file. Otherwise, its value is detected.
# Defaults to $::os_service_default.
#
# [*ipxe_bootfile_name*]
# (optional) Bootfile DHCP parameter when the ipxe boot interface is set
# for a baremetal node. If not set, its value is detected.
# Defaults to $::os_service_default.
#
# [*ipxe_config_template*]
# (optional) Template file for PXE configuration with the iPXE boot
# interface. If set, should be an valid template file. Otherwise,
# its value is detected.
# Defaults to $::os_service_default.
#
# [*tftp_server*]
# (optional) IP address of Ironic compute node's tftp server.
@ -72,6 +82,12 @@
# (optional) Template file for PXE configuration for UEFI boot loader.
# Defaults to $::os_service_default.
#
# [*uefi_ipxe_bootfile_name*]
# (optional) Bootfile DHCP parameter for UEFI boot mode for the
# ipxe boot interface. No separate configuration template is required
# when using ipxe.
# Defaults to ipxe.efi
#
# [*ipxe_timeout*]
# (optional) ipxe timeout in second.
# Should be an valid integer
@ -96,8 +112,10 @@
class ironic::drivers::pxe (
$ipxe_enabled = false,
$pxe_append_params = $::os_service_default,
$pxe_bootfile_name = undef,
$pxe_config_template = undef,
$pxe_bootfile_name = $::os_service_default,
$pxe_config_template = $::os_service_default,
$ipxe_bootfile_name = $::os_service_default,
$ipxe_config_template = $::os_service_default,
$tftp_server = $::os_service_default,
$tftp_root = '/tftpboot',
$images_path = $::os_service_default,
@ -105,6 +123,7 @@ class ironic::drivers::pxe (
$instance_master_path = $::os_service_default,
$uefi_pxe_bootfile_name = $::os_service_default,
$uefi_pxe_config_template = $::os_service_default,
$uefi_ipxe_bootfile_name = 'ipxe.efi',
$ipxe_timeout = $::os_service_default,
$enable_ppc64le = false,
$boot_retry_timeout = $::os_service_default,
@ -117,20 +136,14 @@ class ironic::drivers::pxe (
$tftp_root_real = pick($::ironic::pxe::common::tftp_root, $tftp_root)
$ipxe_timeout_real = pick($::ironic::pxe::common::ipxe_timeout, $ipxe_timeout)
if $ipxe_enabled {
$pxe_bootfile_name_real = pick($pxe_bootfile_name, 'undionly.kpxe')
$pxe_config_template_real = pick($pxe_config_template, '$pybasedir/drivers/modules/ipxe_config.template')
} else {
$pxe_bootfile_name_real = pick($pxe_bootfile_name, 'pxelinux.0')
$pxe_config_template_real = pick($pxe_config_template, '$pybasedir/drivers/modules/pxe_config.template')
}
# Configure ironic.conf
ironic_config {
'pxe/ipxe_enabled': value => $ipxe_enabled;
'pxe/pxe_append_params': value => $pxe_append_params;
'pxe/pxe_bootfile_name': value => $pxe_bootfile_name_real;
'pxe/pxe_config_template': value => $pxe_config_template_real;
'pxe/pxe_bootfile_name': value => $pxe_bootfile_name;
'pxe/pxe_config_template': value => $pxe_config_template;
'pxe/ipxe_bootfile_name': value => $ipxe_bootfile_name;
'pxe/ipxe_config_template': value => $ipxe_config_template;
'pxe/tftp_server': value => $tftp_server;
'pxe/tftp_root': value => $tftp_root_real;
'pxe/images_path': value => $images_path;
@ -138,6 +151,7 @@ class ironic::drivers::pxe (
'pxe/instance_master_path': value => $instance_master_path;
'pxe/uefi_pxe_bootfile_name': value => $uefi_pxe_bootfile_name;
'pxe/uefi_pxe_config_template': value => $uefi_pxe_config_template;
'pxe/uefi_ipxe_bootfile_name': value => $uefi_ipxe_bootfile_name;
'pxe/ipxe_timeout': value => $ipxe_timeout_real;
'pxe/boot_retry_timeout': value => $boot_retry_timeout;
'pxe/boot_retry_check_interval': value => $boot_retry_check_interval;
@ -150,7 +164,12 @@ class ironic::drivers::pxe (
# architecture
ironic_config {
# NOTE(tonyb): This first value shouldn't be needed but seems to be?
'pxe/pxe_config_template_by_arch': value => "ppc64le:${pxe_config_template_real}";
# NOTE(TheJulia): Likely not needed as this just points to the default,
# and when the explicit pxe driver is used everything should fall to
# it but in the interest of minimizing impact, the output result
# is preserved as we now just allow the default for normal template
# operation to be used.
'pxe/pxe_config_template_by_arch': value => 'ppc64le:$pybasedir/drivers/modules/pxe_config.template';
'pxe/pxe_bootfile_name_by_arch': value => 'ppc64le:config';
}
}

View File

@ -57,16 +57,23 @@
# in the source file being /usr/share/ipxe/ipxe-snponly-x86_64.efi
# Defaults to 'ipxe'
#
# [*uefi_ipxe_bootfile_name*]
# (optional) Name of efi file used to boot servers with iPXE + UEFI. This
# should be consistent with the uefi_ipxe_bootfile_name parameter in pxe
# driver.
# Defaults to 'ipxe.efi'
#
class ironic::pxe (
$package_ensure = 'present',
$tftp_root = '/tftpboot',
$http_root = '/httpboot',
$http_port = '8088',
$syslinux_path = $::ironic::params::syslinux_path,
$syslinux_files = $::ironic::params::syslinux_files,
$tftp_bind_host = undef,
$enable_ppc64le = false,
$ipxe_name_base = 'ipxe',
$package_ensure = 'present',
$tftp_root = '/tftpboot',
$http_root = '/httpboot',
$http_port = '8088',
$syslinux_path = $::ironic::params::syslinux_path,
$syslinux_files = $::ironic::params::syslinux_files,
$tftp_bind_host = undef,
$enable_ppc64le = false,
$ipxe_name_base = 'ipxe',
$uefi_ipxe_bootfile_name = 'ipxe.efi'
) inherits ::ironic::params {
include ::ironic::deps
@ -182,7 +189,7 @@ class ironic::pxe (
require => Anchor['ironic-inspector::install::end'],
}
file { "${tftp_root_real}/ipxe.efi":
file { "${tftp_root_real}/${uefi_ipxe_bootfile_name}":
ensure => 'file',
seltype => 'tftpdir_t',
owner => 'ironic',

View File

@ -0,0 +1,30 @@
---
features:
- Adds support for the ``ironic.conf`` parameters ``[pxe]ipxe_bootfile_name``
and ``[pxe]ipxe_config_template`` which are utilized by the ``ipxe`` boot
interface in Ironic. These settings use the manifest parameters
``ironic::drivers::pxe::ipxe_bootfile_name`` and
``ironic::drivers::pxe::ipxe_config_template`` respectively.
- Adds support for the ``ironic.conf`` parameter
``[pxe]uefi_ipxe_bootfile_name`` to be explicitly set using the
``ironic::drivers::pxe::uefi_ipxe_bootfile_name`` manifest parameter.
- |
The new ``ironic::pxe::uefi_ipxe_bootfile_name`` parameter has been added.
This parameter is used to determine name of the efi file used to boot nodes
with UEFI + iPXE.
upgrade:
- The manifest now no longer applies override defaults for a number of
``ironic.conf`` settings, as they match the default settings the project
utilizes. These manifest parameters are
``ironic::drivers::pxe::pxe_bootfile_name``,
``ironic::drivers::pxe::pxe_config_template``,
``ironic::drivers::pxe::tftp_root``,
``ironic::drivers::pxe::tftp_master_path``.
fixes:
- |
Fixes a potential issue where use of the
``ironic::drivers::pxe::ipxe_enabled`` parameter would
cause settings specific to ``ipxe`` to be set overriding the ``pxe`` boot
interface's defaults in Ironic. This resulted in operators being unable to
choose to boot a node from ``pxe`` and not ``ipxe``. Now the settings are
not overriden as the ``ironic::drivers::pxe::ipxe_enabled`` parameter.

View File

@ -23,10 +23,9 @@ require 'spec_helper'
describe 'ironic::drivers::pxe' do
let :default_params do
{ :pxe_bootfile_name => 'pxelinux.0',
:pxe_config_template => '$pybasedir/drivers/modules/pxe_config.template',
:tftp_root => '/tftpboot',
{ :tftp_root => '/tftpboot',
:tftp_master_path => '/tftpboot/master_images',
:uefi_ipxe_bootfile_name => 'ipxe.efi',
}
end
@ -41,8 +40,10 @@ describe 'ironic::drivers::pxe' do
it 'configures ironic.conf' do
is_expected.to contain_ironic_config('pxe/pxe_append_params').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/pxe_bootfile_name').with_value(p[:pxe_bootfile_name])
is_expected.to contain_ironic_config('pxe/pxe_config_template').with_value(p[:pxe_config_template])
is_expected.to contain_ironic_config('pxe/pxe_bootfile_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/pxe_config_template').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/ipxe_bootfile_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/ipxe_config_template').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/tftp_server').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root])
is_expected.to contain_ironic_config('pxe/images_path').with_value('<SERVICE DEFAULT>')
@ -50,6 +51,7 @@ describe 'ironic::drivers::pxe' do
is_expected.to contain_ironic_config('pxe/instance_master_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/uefi_pxe_bootfile_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/uefi_pxe_config_template').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/uefi_ipxe_bootfile_name').with_value('ipxe.efi')
is_expected.to contain_ironic_config('pxe/ipxe_enabled').with_value(false)
end
@ -62,8 +64,10 @@ describe 'ironic::drivers::pxe' do
it 'detects correct boot parameters' do
is_expected.to contain_ironic_config('pxe/pxe_append_params').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/pxe_bootfile_name').with_value('undionly.kpxe')
is_expected.to contain_ironic_config('pxe/pxe_config_template').with_value('$pybasedir/drivers/modules/ipxe_config.template')
is_expected.to contain_ironic_config('pxe/pxe_bootfile_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/pxe_config_template').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/ipxe_bootfile_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/ipxe_config_template').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/tftp_server').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/tftp_root').with_value(p[:tftp_root])
is_expected.to contain_ironic_config('pxe/images_path').with_value('<SERVICE DEFAULT>')
@ -71,6 +75,7 @@ describe 'ironic::drivers::pxe' do
is_expected.to contain_ironic_config('pxe/instance_master_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/uefi_pxe_bootfile_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/uefi_pxe_config_template').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('pxe/uefi_ipxe_bootfile_name').with_value('ipxe.efi')
is_expected.to contain_ironic_config('pxe/ipxe_enabled').with_value(true)
end
end
@ -99,6 +104,7 @@ describe 'ironic::drivers::pxe' do
:tftp_master_path => '/mnt/master_images',
:instance_master_path => '/mnt/ironic/master_images',
:uefi_pxe_bootfile_name => 'bootx64.efi',
:uefi_ipxe_bootfile_name => 'snponly.efi',
:uefi_pxe_config_template => 'foo-uefi',
:ipxe_timeout => '60',
:ipxe_enabled => true,
@ -119,6 +125,7 @@ describe 'ironic::drivers::pxe' do
is_expected.to contain_ironic_config('pxe/instance_master_path').with_value(p[:instance_master_path])
is_expected.to contain_ironic_config('pxe/uefi_pxe_bootfile_name').with_value(p[:uefi_pxe_bootfile_name])
is_expected.to contain_ironic_config('pxe/uefi_pxe_config_template').with_value(p[:uefi_pxe_config_template])
is_expected.to contain_ironic_config('pxe/uefi_ipxe_bootfile_name').with_value(p[:uefi_ipxe_bootfile_name])
is_expected.to contain_ironic_config('pxe/ipxe_timeout').with_value(p[:ipxe_timeout])
is_expected.to contain_ironic_config('pxe/ipxe_enabled').with_value(p[:ipxe_enabled])
is_expected.to contain_ironic_config('pxe/pxe_bootfile_name').with_value(p[:pxe_bootfile_name])