pxe: Support _by_arch options
This introduces support for the following parameters which defines files used for specific architecture such as aarch64. - [pxe] uefi_pxe_bootfile_name - [pxe] uefi_ipxe_bootfile_name - [pxe] pxe_config_template_by_arch Change-Id: I85a3c71b3dd00dff9538c248d4b1ea7e7ef800cb
This commit is contained in:
@@ -119,6 +119,18 @@
|
||||
# PXE/iXPE boot folders values from the host operating system.
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*pxe_bootfile_name_by_arch*]
|
||||
# (optional) Bootfile DHCP parameter per node architecture.
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*ipxe_bootfile_name_by_arch*]
|
||||
# (optional) Bootfile DHCP parameter per node architecture.
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*pxe_config_template_by_arch*]
|
||||
# (optional) Template file for PXE configuration per node architecture.
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*ip_version*]
|
||||
@@ -129,28 +141,31 @@
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
class ironic::drivers::pxe (
|
||||
$kernel_append_params = $facts['os_service_default'],
|
||||
$pxe_bootfile_name = $facts['os_service_default'],
|
||||
$pxe_config_template = $facts['os_service_default'],
|
||||
$ipxe_bootfile_name = $facts['os_service_default'],
|
||||
$ipxe_config_template = $facts['os_service_default'],
|
||||
$tftp_server = $facts['os_service_default'],
|
||||
$tftp_root = '/tftpboot',
|
||||
$images_path = $facts['os_service_default'],
|
||||
$tftp_master_path = $facts['os_service_default'],
|
||||
$instance_master_path = $facts['os_service_default'],
|
||||
$uefi_pxe_bootfile_name = $::ironic::params::uefi_pxe_bootfile_name,
|
||||
$uefi_pxe_config_template = $facts['os_service_default'],
|
||||
$uefi_ipxe_bootfile_name = $::ironic::params::uefi_ipxe_bootfile_name,
|
||||
$ipxe_timeout = $facts['os_service_default'],
|
||||
Boolean $enable_ppc64le = false,
|
||||
$boot_retry_timeout = $facts['os_service_default'],
|
||||
$boot_retry_check_interval = $facts['os_service_default'],
|
||||
$dir_permission = $facts['os_service_default'],
|
||||
$file_permission = $facts['os_service_default'],
|
||||
$loader_file_paths = $facts['os_service_default'],
|
||||
$kernel_append_params = $facts['os_service_default'],
|
||||
$pxe_bootfile_name = $facts['os_service_default'],
|
||||
$pxe_config_template = $facts['os_service_default'],
|
||||
$ipxe_bootfile_name = $facts['os_service_default'],
|
||||
$ipxe_config_template = $facts['os_service_default'],
|
||||
$tftp_server = $facts['os_service_default'],
|
||||
$tftp_root = '/tftpboot',
|
||||
$images_path = $facts['os_service_default'],
|
||||
$tftp_master_path = $facts['os_service_default'],
|
||||
$instance_master_path = $facts['os_service_default'],
|
||||
$uefi_pxe_bootfile_name = $::ironic::params::uefi_pxe_bootfile_name,
|
||||
$uefi_pxe_config_template = $facts['os_service_default'],
|
||||
$uefi_ipxe_bootfile_name = $::ironic::params::uefi_ipxe_bootfile_name,
|
||||
$ipxe_timeout = $facts['os_service_default'],
|
||||
Boolean $enable_ppc64le = false,
|
||||
$boot_retry_timeout = $facts['os_service_default'],
|
||||
$boot_retry_check_interval = $facts['os_service_default'],
|
||||
$dir_permission = $facts['os_service_default'],
|
||||
$file_permission = $facts['os_service_default'],
|
||||
$loader_file_paths = $facts['os_service_default'],
|
||||
$pxe_bootfile_name_by_arch = $facts['os_service_default'],
|
||||
$ipxe_bootfile_name_by_arch = $facts['os_service_default'],
|
||||
$pxe_config_template_by_arch = $facts['os_service_default'],
|
||||
# DEPRECATED PARAMETERS
|
||||
$ip_version = undef,
|
||||
$ip_version = undef,
|
||||
) inherits ironic::params {
|
||||
|
||||
include ironic::deps
|
||||
@@ -196,6 +211,19 @@ class ironic::drivers::pxe (
|
||||
'pxe/ip_version': value => $ip_version_real;
|
||||
}
|
||||
|
||||
$pxe_bootfile_name_by_arch_real = $pxe_bootfile_name_by_arch ? {
|
||||
Hash => join(join_keys_to_values($pxe_bootfile_name_by_arch, ':'), ','),
|
||||
default => join(any2array($pxe_bootfile_name_by_arch), ',')
|
||||
}
|
||||
$ipxe_bootfile_name_by_arch_real = $ipxe_bootfile_name_by_arch ? {
|
||||
Hash => join(join_keys_to_values($ipxe_bootfile_name_by_arch, ':'), ','),
|
||||
default => join(any2array($ipxe_bootfile_name_by_arch), ',')
|
||||
}
|
||||
$pxe_config_template_by_arch_real = $pxe_config_template_by_arch ? {
|
||||
Hash => join(join_keys_to_values($pxe_config_template_by_arch, ':'), ','),
|
||||
default => join(any2array($pxe_config_template_by_arch), ',')
|
||||
}
|
||||
|
||||
if $enable_ppc64le {
|
||||
# FXIME(tonyb): As these are really hash values it would be better to model
|
||||
# them that way. We can do that later, probably when we add another
|
||||
@@ -210,6 +238,15 @@ class ironic::drivers::pxe (
|
||||
'pxe/pxe_config_template_by_arch': value => 'ppc64le:$pybasedir/drivers/modules/pxe_config.template';
|
||||
'pxe/pxe_bootfile_name_by_arch': value => 'ppc64le:config';
|
||||
}
|
||||
} else {
|
||||
ironic_config {
|
||||
'pxe/pxe_config_template_by_arch': value => $pxe_config_template_by_arch_real;
|
||||
'pxe/pxe_bootfile_name_by_arch': value => $pxe_bootfile_name_by_arch_real;
|
||||
}
|
||||
}
|
||||
|
||||
ironic_config {
|
||||
'pxe/ipxe_bootfile_name_by_arch': value => $ipxe_bootfile_name_by_arch_real;
|
||||
}
|
||||
|
||||
}
|
||||
|
9
releasenotes/notes/pxe_by_arch-551ebe3bf9b5e7d4.yaml
Normal file
9
releasenotes/notes/pxe_by_arch-551ebe3bf9b5e7d4.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The following parameters have been added to the ``ironic::drive::pxe``
|
||||
class.
|
||||
|
||||
- ``pxe_bootfile_name_by_arch``
|
||||
- ``ipxe_bootfile_name_by_arch``
|
||||
- ``pxe_config_template_by_arch``
|
@@ -45,6 +45,9 @@ describe 'ironic::drivers::pxe' do
|
||||
is_expected.to contain_ironic_config('pxe/file_permission').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('pxe/loader_file_paths').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('pxe/ipxe_enabled').with_ensure('absent')
|
||||
is_expected.to contain_ironic_config('pxe/pxe_bootfile_name_by_arch').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('pxe/ipxe_bootfile_name_by_arch').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('pxe/pxe_config_template_by_arch').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
context 'when overriding only enable_ppc64le' do
|
||||
@@ -63,25 +66,36 @@ describe 'ironic::drivers::pxe' do
|
||||
context 'when overriding parameters' do
|
||||
before do
|
||||
params.merge!(
|
||||
:kernel_append_params => 'foo',
|
||||
:pxe_config_template => 'bar',
|
||||
:tftp_server => '192.168.0.1',
|
||||
:tftp_root => '/mnt/ftp',
|
||||
:images_path => '/mnt/images',
|
||||
:tftp_master_path => '/mnt/master_images',
|
||||
:instance_master_path => '/mnt/ironic/master_images',
|
||||
:uefi_ipxe_bootfile_name => 'ipxe.efi',
|
||||
:uefi_pxe_bootfile_name => 'shim-x64.efi',
|
||||
:uefi_pxe_config_template => 'foo-uefi',
|
||||
:ipxe_timeout => '60',
|
||||
:pxe_bootfile_name => 'bootx64',
|
||||
:boot_retry_timeout => 600,
|
||||
:boot_retry_check_interval => 120,
|
||||
:dir_permission => '0o755',
|
||||
:file_permission => '0o644',
|
||||
:loader_file_paths => ['ipxe.efi:/usr/share/ipxe/ipxe-snponly-x86_64.efi',
|
||||
'undionly.kpxe:/usr/share/ipxe/undionly.kpxe'],
|
||||
:ip_version => 6,
|
||||
:kernel_append_params => 'foo',
|
||||
:pxe_config_template => 'bar',
|
||||
:tftp_server => '192.168.0.1',
|
||||
:tftp_root => '/mnt/ftp',
|
||||
:images_path => '/mnt/images',
|
||||
:tftp_master_path => '/mnt/master_images',
|
||||
:instance_master_path => '/mnt/ironic/master_images',
|
||||
:uefi_ipxe_bootfile_name => 'ipxe.efi',
|
||||
:uefi_pxe_bootfile_name => 'shim-x64.efi',
|
||||
:uefi_pxe_config_template => 'foo-uefi',
|
||||
:ipxe_timeout => '60',
|
||||
:pxe_bootfile_name => 'bootx64',
|
||||
:boot_retry_timeout => 600,
|
||||
:boot_retry_check_interval => 120,
|
||||
:dir_permission => '0o755',
|
||||
:file_permission => '0o644',
|
||||
:loader_file_paths => [
|
||||
'ipxe.efi:/usr/share/ipxe/ipxe-snponly-x86_64.efi',
|
||||
'undionly.kpxe:/usr/share/ipxe/undionly.kpxe'
|
||||
],
|
||||
:ip_version => 6,
|
||||
:pxe_bootfile_name_by_arch => [
|
||||
'aarch64:grubaa64.efi'
|
||||
],
|
||||
:ipxe_bootfile_name_by_arch => [
|
||||
'aarch64:ipxe_aa64.efi'
|
||||
],
|
||||
:pxe_config_template_by_arch => [
|
||||
'aarch64:/opt/share/grubaa64_pxe_config.template'
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
@@ -105,22 +119,39 @@ describe 'ironic::drivers::pxe' do
|
||||
is_expected.to contain_ironic_config('pxe/loader_file_paths')
|
||||
.with_value('ipxe.efi:/usr/share/ipxe/ipxe-snponly-x86_64.efi,undionly.kpxe:/usr/share/ipxe/undionly.kpxe')
|
||||
is_expected.to contain_ironic_config('pxe/ip_version').with_value(params[:ip_version])
|
||||
is_expected.to contain_ironic_config('pxe/pxe_bootfile_name_by_arch').with_value('aarch64:grubaa64.efi')
|
||||
is_expected.to contain_ironic_config('pxe/ipxe_bootfile_name_by_arch').with_value('aarch64:ipxe_aa64.efi')
|
||||
is_expected.to contain_ironic_config('pxe/pxe_config_template_by_arch')
|
||||
.with_value('aarch64:/opt/share/grubaa64_pxe_config.template')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when overriding parameters (hash values)' do
|
||||
before do
|
||||
params.merge!(
|
||||
:loader_file_paths => {
|
||||
:loader_file_paths => {
|
||||
'ipxe.efi' => '/usr/share/ipxe/ipxe-snponly-x86_64.efi',
|
||||
'undionly.kpxe' => '/usr/share/ipxe/undionly.kpxe'
|
||||
},
|
||||
:pxe_bootfile_name_by_arch => {
|
||||
'aarch64' => 'grubaa64.efi'
|
||||
},
|
||||
:ipxe_bootfile_name_by_arch => {
|
||||
'aarch64' => 'ipxe_aa64.efi'
|
||||
},
|
||||
:pxe_config_template_by_arch => {
|
||||
'aarch64' => '/opt/share/grubaa64_pxe_config.template'
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it 'should replace default parameter with new value' do
|
||||
is_expected.to contain_ironic_config('pxe/loader_file_paths')
|
||||
.with_value('ipxe.efi:/usr/share/ipxe/ipxe-snponly-x86_64.efi,undionly.kpxe:/usr/share/ipxe/undionly.kpxe')
|
||||
is_expected.to contain_ironic_config('pxe/pxe_bootfile_name_by_arch').with_value('aarch64:grubaa64.efi')
|
||||
is_expected.to contain_ironic_config('pxe/ipxe_bootfile_name_by_arch').with_value('aarch64:ipxe_aa64.efi')
|
||||
is_expected.to contain_ironic_config('pxe/pxe_config_template_by_arch')
|
||||
.with_value('aarch64:/opt/share/grubaa64_pxe_config.template')
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user