From 3c15a738cecfbd19e376181685a1fcb9f5b98b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Harald=20Jens=C3=A5s?= Date: Mon, 29 Nov 2021 18:43:05 +0100 Subject: [PATCH] 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 c7966378a036a58018ec0c1155ee6b58f52a49ca (to train) Conflicts: manifests/drivers/pxe.pp manifests/inspector.pp spec/classes/ironic_inspector_spec.rb Closes-Bug: #1952652 Change-Id: I1b3ccd8ad8f3ce66c66c58b1dfdca158d749c287 (cherry picked from commit 51ea0c95eabe8dd15493dd719b8ee34079ef3bb1) (cherry picked from commit 2688458cb0eae1b09c50417477a27a8e8dba682b) (cherry picked from commit 806261407470b0085046314d84b394af5bbf5759) (cherry picked from commit d33a9f68d57a1c5cf391bd12cdbae8075991222a) (cherry picked from commit 0f3581d3b577814d11c14be28269adc617b5e576) --- manifests/drivers/pxe.pp | 7 ++++--- manifests/inspector.pp | 16 ++++++++++++---- manifests/pxe.pp | 3 ++- manifests/pxe/common.pp | 13 +++++++++---- ...uefi-ipxe-boot-filename-83fefc1e48ea7f4f.yaml | 8 ++++++++ spec/classes/ironic_inspector_spec.rb | 8 ++++++++ templates/inspector_dnsmasq_http.erb | 4 ++-- 7 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 releasenotes/notes/fix-inspector-dnsmasq-uefi-ipxe-boot-filename-83fefc1e48ea7f4f.yaml diff --git a/manifests/drivers/pxe.pp b/manifests/drivers/pxe.pp index 7c81aa44..2d615e8b 100644 --- a/manifests/drivers/pxe.pp +++ b/manifests/drivers/pxe.pp @@ -133,8 +133,9 @@ class ironic::drivers::pxe ( include ::ironic::deps 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) + $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) # Configure ironic.conf ironic_config { @@ -151,7 +152,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; diff --git a/manifests/inspector.pp b/manifests/inspector.pp index 56ec9338..77e17700 100644 --- a/manifests/inspector.pp +++ b/manifests/inspector.pp @@ -240,6 +240,12 @@ # transport://user:pass@host1:port[,hostN:portN]/virtual_host # Defaults to 'fake://' # +# [*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::inspector ( $package_ensure = 'present', $enabled = true, @@ -290,6 +296,7 @@ class ironic::inspector ( $discovery_default_driver = $::os_service_default, $enable_ppc64le = false, $default_transport_url = 'fake://', + $uefi_ipxe_bootfile_name = 'ipxe.efi', ) { include ::ironic::deps @@ -305,10 +312,11 @@ class ironic::inspector ( fail('Invalid data type, parameter dnsmasq_ip_subnets must be Array type') } - $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) - $ipxe_timeout_real = pick($::ironic::pxe::common::ipxe_timeout, $ipxe_timeout) + $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) + $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', diff --git a/manifests/pxe.pp b/manifests/pxe.pp index e44a31b5..bdaa5ad7 100644 --- a/manifests/pxe.pp +++ b/manifests/pxe.pp @@ -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', diff --git a/manifests/pxe/common.pp b/manifests/pxe/common.pp index d5007792..f143605e 100644 --- a/manifests/pxe/common.pp +++ b/manifests/pxe/common.pp @@ -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, + $tftp_root = undef, + $http_root = undef, + $http_port = undef, + $ipxe_timeout = undef, + $uefi_ipxe_bootfile_name = undef, ) { include ::ironic::deps } diff --git a/releasenotes/notes/fix-inspector-dnsmasq-uefi-ipxe-boot-filename-83fefc1e48ea7f4f.yaml b/releasenotes/notes/fix-inspector-dnsmasq-uefi-ipxe-boot-filename-83fefc1e48ea7f4f.yaml new file mode 100644 index 00000000..e0451c24 --- /dev/null +++ b/releasenotes/notes/fix-inspector-dnsmasq-uefi-ipxe-boot-filename-83fefc1e48ea7f4f.yaml @@ -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 + `_. + diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index dcd289a6..e8e14fa2 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -226,6 +226,7 @@ describe 'ironic::inspector' do :dnsmasq_dhcp_sequential_ip => false, :add_ports => 'all', :always_store_ramdisk_logs => true, + :uefi_ipxe_bootfile_name => 'otherpxe.efi', ) end it 'should replace default parameter with new value' do @@ -273,6 +274,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( diff --git a/templates/inspector_dnsmasq_http.erb b/templates/inspector_dnsmasq_http.erb index 37c8af86..71fb6893 100644 --- a/templates/inspector_dnsmasq_http.erb +++ b/templates/inspector_dnsmasq_http.erb @@ -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 %>