From 4008c9bfa4175a5eb15b2e49cfacb02db1b3c8d9 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Mon, 10 Dec 2018 14:35:42 +0100 Subject: [PATCH] Build UEFI-only ISO for UEFI boot This change makes ironic building UEFI-only bootable ISO image (when being asked to build a UEFI-bootable image) rather than building a hybrid BIOS/UEFI-bootable ISO. The motivation behind this change is to make node boot more predicable in the sense that if the user asks for UEFI boot, the node would either boot over UEFI or fail. On top of that, the ISO image slims down a tad bit and syslinux boot loader presence on the conductor machine is not a requirement any more. Change-Id: If7828f72724cc7532f97cab758a29a9e8345850e Story: 1526753 Task: 28368 --- ironic/common/images.py | 17 ++--------------- ironic/tests/unit/common/test_images.py | 17 +++-------------- .../build-uefi-only-iso-ce6bcb0da578d1d6.yaml | 7 +++++++ 3 files changed, 12 insertions(+), 29 deletions(-) create mode 100644 releasenotes/notes/build-uefi-only-iso-ce6bcb0da578d1d6.yaml diff --git a/ironic/common/images.py b/ironic/common/images.py index 842bd54520..65fd482677 100644 --- a/ironic/common/images.py +++ b/ironic/common/images.py @@ -243,17 +243,12 @@ def create_isolinux_image_for_uefi(output_file, deploy_iso, kernel, ramdisk, :raises: ImageCreationFailed, if image creation failed while copying files or while running command to generate iso. """ - ISOLINUX_BIN = 'isolinux/isolinux.bin' - ISOLINUX_CFG = 'isolinux/isolinux.cfg' - - isolinux_options = {'kernel': '/vmlinuz', 'ramdisk': '/initrd'} grub_options = {'linux': '/vmlinuz', 'initrd': '/initrd'} with utils.tempdir() as tmpdir: files_info = { kernel: 'vmlinuz', ramdisk: 'initrd', - CONF.isolinux_bin: ISOLINUX_BIN, } # Open the deploy iso used to initiate deploy and copy the @@ -274,12 +269,6 @@ def create_isolinux_image_for_uefi(output_file, deploy_iso, kernel, ramdisk, finally: _umount_without_raise(mountdir) - cfg = _generate_cfg(kernel_params, - CONF.isolinux_config_template, isolinux_options) - - isolinux_cfg = os.path.join(tmpdir, ISOLINUX_CFG) - utils.write_to_file(isolinux_cfg, cfg) - # Generate and copy grub config file. grub_cfg = os.path.join(tmpdir, grub_rel_path) grub_conf = _generate_cfg(kernel_params, @@ -288,12 +277,10 @@ def create_isolinux_image_for_uefi(output_file, deploy_iso, kernel, ramdisk, # Create the boot_iso. try: - utils.execute('mkisofs', '-r', '-V', "VMEDIA_BOOT_ISO", - '-cache-inodes', '-J', '-l', '-no-emul-boot', - '-boot-load-size', '4', '-boot-info-table', - '-b', ISOLINUX_BIN, '-eltorito-alt-boot', + utils.execute('mkisofs', '-r', '-V', "VMEDIA_BOOT_ISO", '-l', '-e', e_img_rel_path, '-no-emul-boot', '-o', output_file, tmpdir) + except processutils.ProcessExecutionError as e: LOG.exception("Creating ISO image failed.") raise exception.ImageCreationFailed(image_type='iso', error=e) diff --git a/ironic/tests/unit/common/test_images.py b/ironic/tests/unit/common/test_images.py index 11d7981a34..81c74eb7a0 100644 --- a/ironic/tests/unit/common/test_images.py +++ b/ironic/tests/unit/common/test_images.py @@ -496,19 +496,14 @@ class FsImageTestCase(base.TestCase): files_info = { 'path/to/kernel': 'vmlinuz', 'path/to/ramdisk': 'initrd', - CONF.isolinux_bin: 'isolinux/isolinux.bin', 'path/to/grub': 'relpath/to/grub.cfg', 'sourceabspath/to/efiboot.img': 'path/to/efiboot.img' } - cfg = "cfg" - cfg_file = 'tmpdir/isolinux/isolinux.cfg' grubcfg = "grubcfg" grub_file = 'tmpdir/relpath/to/grub.cfg' - gen_cfg_mock.side_effect = cfg, grubcfg + gen_cfg_mock.side_effect = (grubcfg,) params = ['a=b', 'c'] - isolinux_options = {'kernel': '/vmlinuz', - 'ramdisk': '/initrd'} grub_options = {'linux': '/vmlinuz', 'initrd': '/initrd'} @@ -531,18 +526,12 @@ class FsImageTestCase(base.TestCase): kernel_params=params) mount_mock.assert_called_once_with('path/to/deploy_iso', 'mountdir') create_root_fs_mock.assert_called_once_with('tmpdir', files_info) - gen_cfg_mock.assert_any_call(params, CONF.isolinux_config_template, - isolinux_options) - write_to_file_mock.assert_any_call(cfg_file, cfg) gen_cfg_mock.assert_any_call(params, CONF.grub_config_template, grub_options) write_to_file_mock.assert_any_call(grub_file, grubcfg) execute_mock.assert_called_once_with( - 'mkisofs', '-r', '-V', "VMEDIA_BOOT_ISO", '-cache-inodes', '-J', - '-l', '-no-emul-boot', '-boot-load-size', '4', '-boot-info-table', - '-b', 'isolinux/isolinux.bin', '-eltorito-alt-boot', - '-e', 'path/to/efiboot.img', '-no-emul-boot', - '-o', 'tgt_file', 'tmpdir') + 'mkisofs', '-r', '-V', 'VMEDIA_BOOT_ISO', '-l', '-e', + 'path/to/efiboot.img', '-no-emul-boot', '-o', 'tgt_file', 'tmpdir') umount_mock.assert_called_once_with('mountdir') @mock.patch.object(images, '_create_root_fs', autospec=True) diff --git a/releasenotes/notes/build-uefi-only-iso-ce6bcb0da578d1d6.yaml b/releasenotes/notes/build-uefi-only-iso-ce6bcb0da578d1d6.yaml new file mode 100644 index 0000000000..1f736d462d --- /dev/null +++ b/releasenotes/notes/build-uefi-only-iso-ce6bcb0da578d1d6.yaml @@ -0,0 +1,7 @@ +--- +other: + - | + The Bare Metal service now builds UEFI-only bootable ISO image (when being asked to + build a UEFI-bootable image) rather than building a hybrid + BIOS/UEFI-bootable ISO. +