Add support for configuring ppc64le nodes

The aim of this change to the enable puppet-ironic as used by tripleo to
configure ironic and the tftp services in a way that "just works" with
tripleo.

It adds the ability to tweak ironic's command retry and spacing values
as well as creating architecture specific config and bootfile mappings

Blueprint: multiarch-support
Change-Id: Ia64dd21b55474d402315ba7c05e28604fff3aea8
This commit is contained in:
Tony Breeds 2018-01-16 15:43:11 +11:00
parent b52c09b11e
commit 75477a9754
9 changed files with 124 additions and 0 deletions

View File

@ -24,8 +24,14 @@
# Should be an interger value
# Defaults to $::os_service_default
#
# [*min_command_interval*]
# (optional) Minimum time, in seconds, between IPMI operations.
# Should be an interger value
# Defaults to $::os_service_default
#
class ironic::drivers::ipmi (
$command_retry_timeout = $::os_service_default,
$min_command_interval = $::os_service_default,
) {
include ::ironic::deps
@ -33,6 +39,7 @@ class ironic::drivers::ipmi (
# Configure ironic.conf
ironic_config {
'ipmi/command_retry_timeout': value => $command_retry_timeout;
'ipmi/min_command_interval': value => $min_command_interval;
}
}

View File

@ -77,6 +77,10 @@
# Should be an valid integer
# Defaults to $::os_service_default.
#
# [*enable_ppc64le*]
# (optional) Boolean value to dtermine if ppc64le support should be enabled
# Defaults to false (no ppc64le support)
#
class ironic::drivers::pxe (
$ipxe_enabled = false,
$pxe_append_params = $::os_service_default,
@ -90,6 +94,7 @@ class ironic::drivers::pxe (
$uefi_pxe_bootfile_name = $::os_service_default,
$uefi_pxe_config_template = $::os_service_default,
$ipxe_timeout = $::os_service_default,
$enable_ppc64le = false,
) {
include ::ironic::deps
@ -121,4 +126,15 @@ class ironic::drivers::pxe (
'pxe/ipxe_timeout': value => $ipxe_timeout_real;
}
if $enable_ppc64le {
# FXIME(tonyb): As these are really hash values it would beter to model
# them that way. We can do that later, probably when we add another
# 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}";
'pxe/pxe_bootfile_name_by_arch': value => 'ppc64le:config';
}
}
}

View File

@ -221,6 +221,10 @@
# Requires node_not_found_hook set to "enroll".
# Defaults to $::os_service_default
#
# [*enable_ppc64le*]
# (optional) Boolean value to dtermine if ppc64le support should be enabled
# Defaults to false (no ppc64le support)
#
class ironic::inspector (
$package_ensure = 'present',
$enabled = true,
@ -268,6 +272,7 @@ class ironic::inspector (
$http_root = '/httpboot',
$node_not_found_hook = $::os_service_default,
$discovery_default_driver = $::os_service_default,
$enable_ppc64le = false,
) {
include ::ironic::deps
@ -310,6 +315,16 @@ class ironic::inspector (
content => template('ironic/inspector_pxelinux_cfg.erb'),
require => Anchor['ironic-inspector::config::begin'],
}
if $enable_ppc64le {
file { "${tftp_root_real}/ppc64le/default":
ensure => 'present',
seltype => 'tftpdir_t',
owner => 'ironic-inspector',
group => 'ironic-inspector',
content => template('ironic/inspector_pxelinux_cfg.erb'),
require => Anchor['ironic-inspector::config::begin'],
}
}
}
if $pxe_transfer_protocol == 'http' {

View File

@ -47,6 +47,10 @@
# (optional) The IP address xinetd will listen on for TFTP.
# Defaults to undef (listen on all ip addresses).
#
# [*enable_ppc64le*]
# (optional) Boolean value to dtermine if ppc64le support should be enabled
# Defaults to false (no ppc64le support)
#
class ironic::pxe (
$package_ensure = 'present',
$tftp_root = '/tftpboot',
@ -55,6 +59,7 @@ class ironic::pxe (
$syslinux_path = $::ironic::params::syslinux_path,
$syslinux_files = $::ironic::params::syslinux_files,
$tftp_bind_host = undef,
$enable_ppc64le = false,
) inherits ::ironic::params {
include ::ironic::deps
@ -86,6 +91,16 @@ class ironic::pxe (
require => Anchor['ironic::install::end'],
}
if $enable_ppc64le {
file { "${tftp_root_real}/ppc64le":
ensure => 'directory',
seltype => 'tftpdir_t',
owner => 'ironic',
group => 'ironic',
require => Anchor['ironic::install::end'],
}
}
file { $http_root_real:
ensure => 'directory',
seltype => 'httpd_sys_content_t',

View File

@ -37,14 +37,17 @@ describe 'ironic::drivers::ipmi' do
it 'configures ironic.conf' do
is_expected.to contain_ironic_config('ipmi/command_retry_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_config('ipmi/min_command_interval').with_value('<SERVICE DEFAULT>')
end
context 'when overriding parameters' do
before do
params.merge!(:command_retry_timeout => '50')
params.merge!(:min_command_interval => '5')
end
it 'should replace default parameter with new value' do
is_expected.to contain_ironic_config('ipmi/command_retry_timeout').with_value('50')
is_expected.to contain_ironic_config('ipmi/min_command_interval').with_value('5')
end
end

View File

@ -75,6 +75,19 @@ describe 'ironic::drivers::pxe' do
end
end
context 'when overriding only enable_ppc64le' do
before do
params.merge!(
:enable_ppc64le => true,
)
end
it 'detects correct ppc64le parameters' do
is_expected.to contain_ironic_config('pxe/pxe_config_template_by_arch').with_value('ppc64le:$pybasedir/drivers/modules/pxe_config.template')
is_expected.to contain_ironic_config('pxe/pxe_bootfile_name_by_arch').with_value('ppc64le:config')
end
end
context 'when overriding parameters' do
before do
params.merge!(

View File

@ -264,6 +264,37 @@ describe 'ironic::inspector' do
end
end
end
context 'when enabling ppc64le support' do
let :pre_condition do
"class { 'ironic::inspector::authtoken': password => 'password', }
class { 'ironic::pxe': enable_ppc64le => true, }"
end
before do
params.merge!(
:enable_ppc64le => true,
)
end
it 'should contain file /etc/ironic-inspector/dnsmasq.conf' do
is_expected.to contain_file('/etc/ironic-inspector/dnsmasq.conf').with_content(
/dhcp-match=set:ppc64le,option:client-arch,14/)
end
it 'should contain file /tftpboot/ppc64le/default' do
is_expected.to contain_file('/tftpboot/ppc64le/default').with(
'owner' => 'ironic-inspector',
'group' => 'ironic-inspector',
'seltype' => 'tftpdir_t',
'ensure' => 'present',
'require' => 'Anchor[ironic-inspector::config::begin]',
'content' => /default/,
)
is_expected.to contain_file('/tftpboot/ppc64le/default').with_content(
/initrd=agent.ramdisk ipa-inspection-callback-url=http:\/\/192.168.0.1:5050\/v1\/continue ipa-inspection-collectors=default/
)
end
end
end
on_supported_os({

View File

@ -139,6 +139,23 @@ describe 'ironic::pxe' do
is_expected.not_to contain_file('/tftpboot/pxelinux.0')
end
end
context 'when enabling ppc64le support' do
before :each do
params.merge!(
:enable_ppc64le => true,
)
end
it 'should contain directory /tftpboot/ppc64le with selinux type tftpdir_t' do
is_expected.to contain_file('/tftpboot/ppc64le').with(
'owner' => 'ironic',
'group' => 'ironic',
'require' => 'Anchor[ironic::install::end]',
'ensure' => 'directory',
'seltype' => 'tftpdir_t',
)
end
end
end
on_supported_os({

View File

@ -26,3 +26,10 @@ dhcp-sequential-ip
<% if @dnsmasq_dhcp_hostsdir %>
dhcp-hostsdir=<%= @dnsmasq_dhcp_hostsdir %>
<% end %>
<% if @enable_ppc64le -%>
# Client is ppc64le (OPAL) box and doesn't need a chain loader, but does need a custom config
dhcp-match=set:ppc64le,option:client-arch,14
dhcp-boot=tag:ppc64le,
dhcp-option=tag:ppc64le, 210,<%= @tftp_root_real %>/ppc64le/
dhcp-option=tag:ppc64le, 209,default
<% end -%>