iPXE: retry on failure during introspection

Ensure iPXE retry to boot from the network in case of failure.
--timeout is required to avoid an unlimited freeze, the goto loop is
here to force iPXE to retry the download. imgfree ensure the image get
clean.

References:
 I0fbb40c711a707ae9fae186e9afbe62b79168e28
 I472dfb73044df50849c9cf72de90e59151698376
 Issue: #1326656

Change-Id: I6782f6499a8a8a9706415b3c9b22d41a9abb2e30
This commit is contained in:
Gonéri Le Bouder
2016-04-26 14:45:45 -04:00
parent 76cb4f73e0
commit 9d56010c8c
3 changed files with 27 additions and 5 deletions

View File

@ -146,6 +146,10 @@
# 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,
@ -179,6 +183,7 @@ class ironic::inspector (
$ramdisk_collectors = 'default',
$additional_processing_hooks = undef,
$ramdisk_kernel_args = undef,
$ipxe_timeout = 0,
) {
include ::ironic::params

View File

@ -44,7 +44,8 @@ describe 'ironic::inspector' do
: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
@ -181,7 +182,7 @@ describe 'ironic::inspector' do
'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
@ -196,6 +197,19 @@ describe 'ironic::inspector' do
'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

View File

@ -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=agent.ramdisk
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