Skip to content

Commit

Permalink
Update ironic to 565ee8d0d17776e2d011c907c83f91d16fd13a22
Browse files Browse the repository at this point in the history
565ee8d0d17776e2d011c907c83f91d16fd13a22 iPXE: retry on failure during introspection
ec57c415f408fd8adab75fd5cbfa043d99787b47 Copy iPXE ROMs into /tftpboot
013a182f404491eff2b4a6b309cff5c855fce1e1 Allow chainloading of Inspector ramdisk over UEFI
9e9a162568ba74149288782def23d033f0fb72f1 Gemfile: rely on puppet-openstack_spec_helper for dependencies

Change-Id: Ia8fa1c541d358dd961a9bb7c6ef9442271e3e47e
  • Loading branch information
jguiditta committed May 18, 2016
1 parent e40dc0f commit 03973c2
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ mod 'inifile',
:git => 'https://github.com/puppetlabs/puppetlabs-inifile.git'

mod 'ironic',
:commit => 'fc2496a4ef7f123bf4cdb3cb1ea7c32ce8c23262',
:commit => '565ee8d0d17776e2d011c907c83f91d16fd13a22',
:git => 'https://github.com/openstack/puppet-ironic.git'

mod 'java',
Expand Down
24 changes: 5 additions & 19 deletions ironic/Gemfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"

group :development, :test do
gem 'puppetlabs_spec_helper', :require => 'false'
gem 'rspec-puppet', '~> 2.2.0', :require => 'false'
gem 'metadata-json-lint', :require => 'false'
gem 'puppet-lint-param-docs', :require => 'false'
gem 'puppet-lint-absolute_classname-check', :require => 'false'
gem 'puppet-lint-absolute_template_path', :require => 'false'
gem 'puppet-lint-trailing_newline-check', :require => 'false'
gem 'puppet-lint-unquoted_string-check', :require => 'false'
gem 'puppet-lint-leading_zero-check', :require => 'false'
gem 'puppet-lint-variable_contains_upcase', :require => 'false'
gem 'puppet-lint-numericvariable', :require => 'false'
gem 'json', :require => 'false'
end

group :system_tests do
gem 'beaker-rspec', :require => 'false'
gem 'beaker-puppet_install_helper', :require => 'false'
gem 'r10k', :require => 'false'
group :development, :test, :system_tests do
gem 'puppet-openstack_spec_helper',
:git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper',
:branch => 'stable/liberty',
:require => false
end

if facterversion = ENV['FACTER_GEM_VERSION']
Expand Down
28 changes: 28 additions & 0 deletions ironic/manifests/inspector.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
# (optional) Protocol to be used for transferring the ramdisk
# Defaults to 'tftp'. Valid values are 'tftp' or 'http'.
#
# [*enable_uefi*]
# (optional) Allow introspection of machines with UEFI firmware.
# Defaults to false. Ignored unless $pxe_transfer_protocol='http'.
#
# [*debug*]
# (optional) Enable debug logging
# Defaults to false
Expand Down Expand Up @@ -142,11 +146,16 @@
# String with kernel arguments to send to the ramdisk on boot.
# Defaults to undef
#
# [*ipxe_timeout*]
# (optional) ipxe timeout in second. Should be an integer.
# Defaults to '0' for unlimited.
#
class ironic::inspector (
$package_ensure = 'present',
$enabled = true,
$pxe_transfer_protocol = 'tftp',
$debug = false,
$enable_uefi = false,
$auth_uri = 'http://127.0.0.1:5000/v2.0',
$identity_uri = 'http://127.0.0.1:35357',
$admin_user = 'ironic',
Expand Down Expand Up @@ -174,6 +183,7 @@
$ramdisk_collectors = 'default',
$additional_processing_hooks = undef,
$ramdisk_kernel_args = undef,
$ipxe_timeout = 0,
) {

include ::ironic::params
Expand Down Expand Up @@ -219,6 +229,24 @@
content => template('ironic/inspector_ipxe.erb'),
require => Package['ironic-inspector'],
}
if $::ironic::params::ipxe_rom_dir {
file { '/tftpboot/undionly.kpxe':
ensure => 'present',
source => "${::ironic::params::ipxe_rom_dir}/undionly.kpxe",
backup => false,
seltype => 'tftpdir_t',
}
if $enable_uefi {
file { '/tftpboot/ipxe.efi':
ensure => 'present',
source => "${::ironic::params::ipxe_rom_dir}/ipxe.efi",
backup => false,
seltype => 'tftpdir_t',
}
}
} else {
warning('iPXE ROM source location not set, ensure ROMs are copied into /tftpboot')
}
}

# Configure inspector.conf
Expand Down
2 changes: 2 additions & 0 deletions ironic/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
$inspector_dnsmasq_service = 'openstack-ironic-inspector-dnsmasq'
$sqlite_package_name = undef
$pymysql_package_name = undef
$ipxe_rom_dir = '/usr/share/ipxe'
}
'Debian': {
$common_package_name = 'ironic-common'
Expand All @@ -55,6 +56,7 @@
$inspector_dnsmasq_service = 'ironic-inspector-dnsmasq'
$sqlite_package_name = 'python-pysqlite2'
$pymysql_package_name = 'python-pymysql'
$ipxe_rom_dir = '/usr/lib/ipxe'
}
default: {
fail("Unsupported osfamily ${::osfamily}")
Expand Down
40 changes: 38 additions & 2 deletions ironic/spec/classes/ironic_inspector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
:enabled => true,
:pxe_transfer_protocol => 'tftp',
:debug => false,
:enable_uefi => false,
:auth_uri => 'http://127.0.0.1:5000/v2.0',
:identity_uri => 'http://127.0.0.1:35357',
:admin_user => 'ironic',
Expand All @@ -44,7 +45,8 @@
:swift_tenant_name => 'services',
:swift_auth_url => 'http://127.0.0.1:5000/v2.0',
:dnsmasq_ip_range => '192.168.0.100,192.168.0.120',
:dnsmasq_local_ip => '192.168.0.1', }
:dnsmasq_local_ip => '192.168.0.1',
:ipxe_timeout => 0, }
end

let :params do
Expand Down Expand Up @@ -130,6 +132,14 @@
)
end

it 'should not contain BIOS iPXE image by default' do
is_expected.to_not contain_file('/tftpboot/undionly.kpxe')
end

it 'should not contain UEFI iPXE image by default' do
is_expected.to_not contain_file('/tftpboot/ipxe.efi')
end

context 'when overriding parameters' do
before :each do
params.merge!(
Expand All @@ -144,6 +154,7 @@
:pxe_transfer_protocol => 'http',
:additional_processing_hooks => 'hook1,hook2',
:ramdisk_kernel_args => 'foo=bar',
:enable_uefi => true,
)
end
it 'should replace default parameter with new value' do
Expand Down Expand Up @@ -172,9 +183,34 @@
'content' => /ipxe/,
)
is_expected.to contain_file('/httpboot/inspector.ipxe').with_content(
/kernel http:\/\/192.168.0.1:8088\/agent.kernel ipa-inspection-callback-url=http:\/\/192.168.0.1:5050\/v1\/continue ipa-inspection-collectors=default.* foo=bar/
/kernel http:\/\/192.168.0.1:8088\/agent.kernel ipa-inspection-callback-url=http:\/\/192.168.0.1:5050\/v1\/continue ipa-inspection-collectors=default.* foo=bar || goto retry_boot/
)
end
it 'should contain iPXE chainload images' do
is_expected.to contain_file('/tftpboot/undionly.kpxe').with(
'ensure' => 'present',
'backup' => false,
)
end
it 'should contain iPXE UEFI chainload image' do
is_expected.to contain_file('/tftpboot/ipxe.efi').with(
'ensure' => 'present',
'backup' => false,
)
end

context 'when ipxe_timeout is set' do
before :each do
params.merge!(
:ipxe_timeout => 30,
)
end

it 'should contain file /httpboot/inspector.ipxe' do
is_expected.to contain_file('/httpboot/inspector.ipxe').with_content(
/kernel --timeout 30000/)
end
end
end
end

Expand Down
13 changes: 11 additions & 2 deletions ironic/templates/inspector_dnsmasq_http.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ bind-interfaces
dhcp-range=<%= @dnsmasq_ip_range %>,29
enable-tftp
tftp-root=/tftpboot
dhcp-sequential-ip
dhcp-match=ipxe,175
dhcp-boot=tag:!ipxe,undionly.kpxe,localhost.localdomain,<%= @dnsmasq_local_ip %>
<% if @enable_uefi -%>
dhcp-match=set:efi,option:client-arch,7
<% end -%>
# Client is running iPXE; move to next stage of chainloading
dhcp-boot=tag:ipxe,http://<%= @dnsmasq_local_ip %>:8088/inspector.ipxe
dhcp-sequential-ip
<% if @enable_uefi -%>
# Client is running PXE over EFI; send EFI version of iPXE chainloader
dhcp-boot=tag:efi,ipxe.efi
# Client is running PXE over BIOS; send BIOS version of iPXE chainloader
<% end -%>
dhcp-boot=undionly.kpxe,localhost.localdomain,<%= @dnsmasq_local_ip %>
9 changes: 6 additions & 3 deletions ironic/templates/inspector_ipxe.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!ipxe

dhcp
:retry_dhcp
dhcp || goto retry_dhcp

kernel http://<%= @dnsmasq_local_ip %>:8088/agent.kernel ipa-inspection-callback-url=http://<%= @dnsmasq_local_ip %>:5050/v1/continue ipa-inspection-collectors=<%= @ramdisk_collectors %> systemd.journald.forward_to_console=yes BOOTIF=${mac} <%= @ramdisk_kernel_args %>
initrd http://<%= @dnsmasq_local_ip %>:8088/agent.ramdisk
:retry_boot
imgfree
kernel <% if @ipxe_timeout != "0" %>--timeout <%= Integer(@ipxe_timeout) * 1000 %> <% end %>http://<%= @dnsmasq_local_ip %>:8088/agent.kernel ipa-inspection-callback-url=http://<%= @dnsmasq_local_ip %>:5050/v1/continue ipa-inspection-collectors=<%= @ramdisk_collectors %> systemd.journald.forward_to_console=yes BOOTIF=${mac} <%= @ramdisk_kernel_args %> initrd=agent.ramdisk || goto retry_boot
initrd <% if @ipxe_timeout != "0" %>--timeout <%= Integer(@ipxe_timeout) * 1000 %> <% end %>http://<%= @dnsmasq_local_ip %>:8088/agent.ramdisk || goto retry_boot
boot

0 comments on commit 03973c2

Please sign in to comment.