Set 'initrd' to 'rescue_ramdisk' for rescue with iPXE

The kernel paramter 'initrd' is hard-coded as 'deploy_ramdisk' in iPXE
config template. A rescue ramdisk may fail to boot due to this wrong
paramter. This patch sets this 'initrd' paramter properly to
'deploy_ramdisk' or 'rescue_ramdisk' by adding a new pxe option.

Change-Id: I8ad1223dc289bbe915ee4ca8db66c8f80bf08f15
Closes-Bug: 1749860
This commit is contained in:
Hironori Shiina 2018-02-16 10:03:19 +09:00
parent 4df93fc474
commit 8f2e487b2b
5 changed files with 13 additions and 1 deletions

View File

@ -4,7 +4,7 @@ goto deploy
:deploy
imgfree
kernel {% if pxe_options.ipxe_timeout > 0 %}--timeout {{ pxe_options.ipxe_timeout }} {% endif %}{{ pxe_options.deployment_aki_path }} selinux=0 troubleshoot=0 text {{ pxe_options.pxe_append_params|default("", true) }} ip=${ip}:${next-server}:${gateway}:${netmask} BOOTIF=${mac} ipa-api-url={{ pxe_options['ipa-api-url'] }} initrd=deploy_ramdisk coreos.configdrive=0 || goto deploy
kernel {% if pxe_options.ipxe_timeout > 0 %}--timeout {{ pxe_options.ipxe_timeout }} {% endif %}{{ pxe_options.deployment_aki_path }} selinux=0 troubleshoot=0 text {{ pxe_options.pxe_append_params|default("", true) }} ip=${ip}:${next-server}:${gateway}:${netmask} BOOTIF=${mac} ipa-api-url={{ pxe_options['ipa-api-url'] }} initrd={{ pxe_options.initrd_filename|default("deploy_ramdisk", true) }} coreos.configdrive=0 || goto deploy
initrd {% if pxe_options.ipxe_timeout > 0 %}--timeout {{ pxe_options.ipxe_timeout }} {% endif %}{{ pxe_options.deployment_ari_path }} || goto deploy
boot

View File

@ -178,6 +178,8 @@ def _build_deploy_pxe_options(task, pxe_info, mode='deploy'):
else:
pxe_opts[option] = pxe_utils.get_path_relative_to_tftp_root(
pxe_info[label][1])
if CONF.pxe.ipxe_enabled:
pxe_opts['initrd_filename'] = ramdisk_label
return pxe_opts

View File

@ -57,6 +57,7 @@ class TestPXEUtils(db_base.DbTestCase):
'deployment_ari_path': 'http://1.2.3.4:1234/deploy_ramdisk',
'aki_path': 'http://1.2.3.4:1234/kernel',
'ari_path': 'http://1.2.3.4:1234/ramdisk',
'initrd_filename': 'deploy_ramdisk',
})
self.ipxe_options_timeout = self.ipxe_options.copy()
@ -73,6 +74,7 @@ class TestPXEUtils(db_base.DbTestCase):
'username': 'fake_username',
'password': 'fake_password'
})
self.ipxe_options_boot_from_volume.pop('initrd_filename', None)
self.node = object_utils.create_test_node(self.context)

View File

@ -415,6 +415,7 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
'ipxe_timeout': ipxe_timeout_in_ms,
'ari_path': ramdisk,
'aki_path': kernel,
'initrd_filename': ramdisk_label,
}
if mode == 'rescue':
@ -431,6 +432,7 @@ class PXEPrivateMethodsTestCase(db_base.DbTestCase):
'password': 'fake_password'})
expected_options.pop('deployment_aki_path')
expected_options.pop('deployment_ari_path')
expected_options.pop('initrd_filename')
with task_manager.acquire(self.context, self.node.uuid,
shared=True) as task:

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixes rescue timeout due to incorrect kernel parameter in the iPXE script.
See `bug 1749860 <https://bugs.launchpad.net/ironic/+bug/1749860>`_ for
details.