Fix name of iPXE efi bootrom

In change Ia30aff290ec24972f387612851f8f630ddc9403b
the file in tftproot was renamed from ipxe.efi to
snponly.efi. Later in the filename was parameterized
in change I565e3ae6388812c358e86fac49b17e0cce97b9df.

The dnsmasq DHCP configuration was not updated to
point to use the new filename, nor the parameter.

This change adds 'uefi_ipxe_bootfile_name' to
ironic::pxe::common, updates the other manifests to
use ironic::pxe::common::uefi_ipxe_bootfile_name if
set.

Also add the 'uefi_ipxe_bootfile_name' parameter to
the ironic::inspector class and update the dnsmasq
DHCP tempalte to use the parameter.

Backport note:
In stable/wallaby and older, the default uefi_ipxe_bootfile_name is
ipxe.efi(this was updated during Xena cycle), so the inconsistent usage
doesn't happen by default. However support for customizing
uefi_ipxe_bootfile_name is incomplete and it is fixed by this change.

Conflicts:
	manifests/inspector.pp

Resolved conflict caused by c7966378a0

Closes-Bug: #1952652
Change-Id: I1b3ccd8ad8f3ce66c66c58b1dfdca158d749c287
(cherry picked from commit 51ea0c95ea)
(cherry picked from commit 2688458cb0)
(cherry picked from commit 8062614074)
This commit is contained in:
Harald Jensås 2021-11-29 18:43:05 +01:00 committed by Takashi Kajinami
parent 09196e4ae5
commit d33a9f68d5
7 changed files with 45 additions and 14 deletions

View File

@ -140,6 +140,7 @@ class ironic::drivers::pxe (
include ironic::pxe::common
$tftp_root_real = pick($::ironic::pxe::common::tftp_root, $tftp_root)
$ipxe_timeout_real = pick($::ironic::pxe::common::ipxe_timeout, $ipxe_timeout)
$uefi_ipxe_bootfile_name_real = pick($::ironic::pxe::common::uefi_ipxe_bootfile_name, $uefi_ipxe_bootfile_name)
if $ipxe_enabled != undef {
warning('The ironic::drivers::pxe::ipxe_enabled parameter is deprecated and has no effect.')
@ -159,7 +160,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/uefi_ipxe_bootfile_name': value => $uefi_ipxe_bootfile_name_real;
'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;

View File

@ -184,6 +184,12 @@
# Example: {'10.10.10.0/24' => 'physnet_a', '2001:db8::/64' => 'physnet_b'}
# Defaults to {}
#
# [*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'
#
# DEPRECATED PARAMETERS
#
# [*swift_auth_type*]
@ -296,6 +302,7 @@ class ironic::inspector (
$enable_ppc64le = false,
$default_transport_url = 'fake://',
$port_physnet_cidr_map = {},
$uefi_ipxe_bootfile_name = 'ipxe.efi',
# DEPRECATED PARAMETERS
$swift_auth_type = undef,
$swift_username = undef,
@ -345,6 +352,7 @@ Use ironic::inspector::ironic::endpoint_override instead.')
$http_root_real = pick($::ironic::pxe::common::http_root, $http_root)
$http_port_real = pick($::ironic::pxe::common::http_port, $http_port)
$ipxe_timeout_real = pick($::ironic::pxe::common::ipxe_timeout, $ipxe_timeout)
$uefi_ipxe_bootfile_name_real = pick($::ironic::pxe::common::uefi_ipxe_bootfile_name, $uefi_ipxe_bootfile_name)
file { '/etc/ironic-inspector/inspector.conf':
ensure => 'present',

View File

@ -82,6 +82,7 @@ class ironic::pxe (
$tftp_root_real = pick($::ironic::pxe::common::tftp_root, $tftp_root)
$http_root_real = pick($::ironic::pxe::common::http_root, $http_root)
$http_port_real = pick($::ironic::pxe::common::http_port, $http_port)
$uefi_ipxe_bootfile_name_real = pick($::ironic::pxe::common::uefi_ipxe_bootfile_name, $uefi_ipxe_bootfile_name)
if ($::os['name'] == 'Fedora') or
($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) {
@ -189,7 +190,7 @@ class ironic::pxe (
require => Anchor['ironic-inspector::install::end'],
}
file { "${tftp_root_real}/${uefi_ipxe_bootfile_name}":
file { "${tftp_root_real}/${uefi_ipxe_bootfile_name_real}":
ensure => 'file',
seltype => 'tftpdir_t',
owner => 'ironic',

View File

@ -37,11 +37,16 @@
# (optional) ipxe timeout in second. Should be an integer.
# Defaults to undef.
#
# [*uefi_ipxe_bootfile_name*]
# (optional) Name of efi file used to boot servers with iPXE + UEFI.
# Defaults to undef.
#
class ironic::pxe::common (
$tftp_root = undef,
$http_root = undef,
$http_port = undef,
$ipxe_timeout = undef,
$uefi_ipxe_bootfile_name = undef,
) {
include ironic::deps
}

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixed an issue where dnsmasq DHCP configuration for ironic-
inspector would point to the wrong UEFI iPXE bootfile. See
bug: `1952652
<https://bugs.launchpad.net/puppet-ironic/+bug/1952652>`_.

View File

@ -239,6 +239,7 @@ describe 'ironic::inspector' do
:always_store_ramdisk_logs => true,
:port_physnet_cidr_map => {'192.168.20.0/24' => 'physnet_a',
'2001:db8::/64' => 'physnet_b'},
:uefi_ipxe_bootfile_name => 'otherpxe.efi',
)
end
it 'should replace default parameter with new value' do
@ -287,6 +288,13 @@ describe 'ironic::inspector' do
is_expected.not_to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-sequential-ip/
)
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-boot=tag:efi,tag:!ipxe,otherpxe.efi/
)
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-option=tag:efi6,tag:!ipxe6,option6:bootfile-url,tftp:\/\/.*\/otherpxe.efi/
)
end
it 'should contain file /var/www/httpboot/inspector.ipxe' do
is_expected.to contain_file('/var/www/httpboot/inspector.ipxe').with(

View File

@ -54,8 +54,8 @@ dhcp-userclass=set:ipxe6,iPXE
dhcp-boot=tag:ipxe,http://<%= @dnsmasq_local_ip_real %>:<%= @http_port_real %>/inspector.ipxe
dhcp-option=tag:ipxe6,option6:bootfile-url,http://<%= @dnsmasq_local_ip_real %>:<%= @http_port_real %>/inspector.ipxe
# Client is PXE booting over EFI without iPXE ROM; send EFI version of iPXE chainloader
dhcp-boot=tag:efi,tag:!ipxe,ipxe.efi
dhcp-option=tag:efi6,tag:!ipxe6,option6:bootfile-url,tftp://<%= @dnsmasq_local_ip_real %>/ipxe.efi
dhcp-boot=tag:efi,tag:!ipxe,<%= @uefi_ipxe_bootfile_name_real %>
dhcp-option=tag:efi6,tag:!ipxe6,option6:bootfile-url,tftp://<%= @dnsmasq_local_ip_real %>/<%= @uefi_ipxe_bootfile_name_real %>
# Client is running PXE over BIOS; send BIOS version of iPXE chainloader
dhcp-boot=undionly.kpxe,localhost.localdomain,<%= @dnsmasq_local_ip %>
<% if @dnsmasq_dhcp_hostsdir %>