diff --git a/ironic/common/images.py b/ironic/common/images.py index b68911e934..833d76f665 100644 --- a/ironic/common/images.py +++ b/ironic/common/images.py @@ -261,18 +261,16 @@ def create_isolinux_image_for_uefi(output_file, kernel, ramdisk, # Open the deploy iso used to initiate deploy and copy the # efiboot.img i.e. boot loader to the current temporary # directory. - if deploy_iso: + if deploy_iso and not esp_image: uefi_path_info, e_img_rel_path, grub_rel_path = ( _mount_deploy_iso(deploy_iso, mountdir)) grub_cfg = os.path.join(tmpdir, grub_rel_path) # Use ELF boot loader provided - elif esp_image: + elif esp_image and not deploy_iso: e_img_rel_path = EFIBOOT_LOCATION - grub_rel_path = CONF.grub_config_path.strip() - while grub_rel_path.startswith(os.sep): - grub_rel_path = grub_rel_path[1:] + grub_rel_path = CONF.grub_config_path.lstrip(' ' + os.sep) grub_cfg = os.path.join(tmpdir, grub_rel_path) uefi_path_info = { @@ -281,9 +279,10 @@ def create_isolinux_image_for_uefi(output_file, kernel, ramdisk, } else: + msg = _('Neither deploy ISO nor ESP image configured or ' + 'both of them configured') raise exception.ImageCreationFailed( - image_type='iso', - error='Neither `deploy_iso` nor `esp_image` configured') + image_type='iso', error=msg) files_info.update(uefi_path_info) diff --git a/ironic/conf/default.py b/ironic/conf/default.py index ea9ce7c507..f8946f8ae5 100644 --- a/ironic/conf/default.py +++ b/ironic/conf/default.py @@ -230,11 +230,12 @@ image_opts = [ 'efficiently. ESP image should contain a ' 'FAT12/16/32-formatted file system holding EFI boot ' 'loaders (e.g. GRUB2) for each hardware architecture ' - 'ironic needs to boot. If not configured, ironic ' - 'will attempt to fetch ESP image from some remote ' - 'store (if configured) or extract ESP image from ' - 'UEFI-bootable deploy ISO image.')), - + 'ironic needs to boot. This option is only used when ' + 'neither ESP nor ISO deploy image is configured to ' + 'the node being deployed in which case ironic will ' + 'attempt to fetch ESP image from the configured ' + 'location or extract ESP image from UEFI-bootable ' + 'deploy ISO image.')), ] img_cache_opts = [ diff --git a/releasenotes/notes/build-iso-from-esp-d156036aa8ef85fb.yaml b/releasenotes/notes/build-iso-from-esp-d156036aa8ef85fb.yaml index b7871fd21e..43683902e9 100644 --- a/releasenotes/notes/build-iso-from-esp-d156036aa8ef85fb.yaml +++ b/releasenotes/notes/build-iso-from-esp-d156036aa8ef85fb.yaml @@ -5,7 +5,7 @@ features: building UEFI-bootable ISO images, in form of a local file or UUID or URI reference. The new ``[conductor]esp_image`` option can be used to configure ironic to use local file. -other: +fixes: - | Makes ironic building UEFI-only bootable ISO image (when being asked to build a UEFI-bootable image) rather than building a hybrid