Merge "Debian/Ubuntu: Fix installation of pxelinux.0 and syslinux files"

This commit is contained in:
Zuul 2022-07-07 09:34:18 +00:00 committed by Gerrit Code Review
commit 123ad82f7e
4 changed files with 72 additions and 7 deletions

View File

@ -63,6 +63,8 @@ class ironic::params {
$tftpd_package = 'tftp-server'
}
$ipxe_package = 'ipxe-bootimgs'
$pxelinux_package = false
$pxelinux_path = false
$syslinux_package = 'syslinux-tftpboot'
$syslinux_path = '/tftpboot'
$syslinux_files = ['pxelinux.0', 'chain.c32', 'ldlinux.c32']
@ -95,13 +97,11 @@ class ironic::params {
$xinetd_available = true
$tftpd_package = 'tftpd-hpa'
$ipxe_package = 'ipxe'
$pxelinux_package = 'pxelinux'
$pxelinux_path = '/usr/lib/PXELINUX'
$syslinux_package = 'syslinux-common'
if $::operatingsystem == 'Debian' {
$syslinux_path = '/usr/lib/syslinux'
} else {
$syslinux_path = '/var/lib/tftpboot'
}
$syslinux_files = ['pxelinux.0', 'chain.c32', 'libcom32.c32', 'libutil.c32']
$syslinux_path = '/usr/lib/syslinux/modules/bios'
$syslinux_files = ['chain.c32', 'libcom32.c32', 'libutil.c32']
$grub_efi_package = 'grub-efi-amd64-signed'
$grub_efi_file = '/usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed'
$shim_package = 'shim-signed'

View File

@ -34,6 +34,11 @@
# deployment images.
# Defaults to '8088'
#
# [*pxelinux_path*]
# (optional) Path to directory containing pxelinux.0 .
# Setting this to False will skip syslinux related resources.
# Defaults to '$::ironic::params::pxelinux_path'
#
# [*syslinux_path*]
# (optional) Path to directory containing syslinux files.
# Setting this to False will skip syslinux related resources.
@ -79,6 +84,7 @@ class ironic::pxe (
$tftp_root = '/tftpboot',
$http_root = '/httpboot',
$http_port = '8088',
$pxelinux_path = $::ironic::params::pxelinux_path,
$syslinux_path = $::ironic::params::syslinux_path,
$syslinux_files = $::ironic::params::syslinux_files,
$tftp_bind_host = undef,
@ -208,6 +214,24 @@ class ironic::pxe (
File[$tftp_root_real] -> Service['dnsmasq-tftp-server']
}
# NOTE(tkajinam): Ubuntu/Debian requires a separate package for pxelinux.0
# and the file is stored in a different path.
if $pxelinux_path {
if $ironic::params::pxelinux_package {
package { 'pxelinux':
ensure => $package_ensure,
name => $::ironic::params::pxelinux_package,
tag => ['openstack', 'ironic-ipxe', 'ironic-support-package'],
}
}
ironic::pxe::tftpboot_file { 'pxelinux.0':
source_directory => $pxelinux_path,
destination_directory => $tftp_root_real,
require => Anchor['ironic-inspector::install::end'],
}
}
if $syslinux_path {
ensure_resource( 'package', 'syslinux', {
ensure => $package_ensure,

View File

@ -0,0 +1,12 @@
---
fixes:
- |
Now the ``ironic::pxe`` class properly installs the pxelinux.0 file using
the separate ``pxelinux`` package in Debian and Ubuntu. The new
``pxelinux_file_path`` parameter can be used to determine the source path
to locate the file. When this parameter is set to false then the class
does not manage the file.
- |
The wrong source directory to copy syslinux files in Debiand or Ubuntu has
been fixed.

View File

@ -200,7 +200,7 @@ describe 'ironic::pxe' do
is_expected.not_to contain_package('syslinux')
end
it 'should not contain tftpboot syslinux file' do
is_expected.not_to contain_file('/var/lib/ironic/tftpboot/pxelinux.0')
is_expected.not_to contain_file('/var/lib/ironic/tftpboot/chain.c32')
end
end
end
@ -301,6 +301,30 @@ describe 'ironic::pxe' do
end
end
shared_examples_for 'ironic pxe with pxelinux package' do
it 'should contain pxelinux package' do
is_expected.to contain_package('pxelinux').with(
:ensure => 'present',
:name => platform_params[:pxelinux_package],
:tag => ['openstack', 'ironic-ipxe', 'ironic-support-package'],
)
end
context 'when excluding pxelinux' do
before :each do
params.merge!(
:pxelinux_path => false,
)
end
it 'should not contain pxelinux package' do
is_expected.not_to contain_package('pxelinux')
end
it 'should not contain pxelinux.0 file' do
is_expected.not_to contain_file('/var/lib/ironic/tftpboot/pxelinux.0')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
@ -316,6 +340,7 @@ describe 'ironic::pxe' do
:grub_efi_package => 'grub-efi-amd64-signed',
:ipxe_package => 'ipxe',
:shim_package => 'shim-signed',
:pxelinux_package => 'pxelinux',
:syslinux_package => 'syslinux-common',
:tftp_package => 'tftpd-hpa',
}
@ -341,6 +366,10 @@ describe 'ironic::pxe' do
unless facts[:osfamily] == 'RedHat' and facts[:operatingsystemmajrelease].to_i >= 9
it_behaves_like 'ironic pxe with xinetd'
end
if facts[:osfamily] == 'Debian'
it_behaves_like 'ironic pxe with pxelinux package'
end
end
end