summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/image_utils.py
diff options
context:
space:
mode:
authorRiccardo Pittau <elfosardo@gmail.com>2021-04-29 14:58:22 +0200
committerRiccardo Pittau <elfosardo@gmail.com>2021-05-05 14:14:35 +0200
commit4874f3c44e7b49714ca4fb158d2551b8f6f5fee4 (patch)
treeb9eaf4dac42174d49d1d985d0535939b0b25e293 /ironic/drivers/modules/image_utils.py
parentc5cf36d19572268df1bd2436c1fe751d174a8341 (diff)
downloadironic-4874f3c44e7b49714ca4fb158d2551b8f6f5fee4.tar.gz
Provide an option to not cache bootable iso ramdisks
The behavior when a bootable iso is provided behind an http server is to download and serve the image from the conductor; the image is removed only when the node is undeployed. In certain cases, for example on large deployments, this could cause undesired behaviors, like the conductor nodes running out of disk storage. We provide an option to avoid this event directly using the original url of the bootable iso that is then served directly by the external http server where it is hosted. Change-Id: I6ecbe8ae4c775f5a39b68ff698bde655795e5db7
Diffstat (limited to 'ironic/drivers/modules/image_utils.py')
-rw-r--r--ironic/drivers/modules/image_utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/ironic/drivers/modules/image_utils.py b/ironic/drivers/modules/image_utils.py
index f1283b092..37c59ecc3 100644
--- a/ironic/drivers/modules/image_utils.py
+++ b/ironic/drivers/modules/image_utils.py
@@ -404,7 +404,7 @@ def _prepare_iso_image(task, kernel_href, ramdisk_href,
:param kernel_href: URL or Glance UUID of the kernel to use
:param ramdisk_href: URL or Glance UUID of the ramdisk to use
:param bootloader_href: URL or Glance UUID of the EFI bootloader
- image to use when creating UEFI bootbable ISO
+ image to use when creating UEFI bootable ISO
:param root_uuid: optional uuid of the root partition.
:param params: a dictionary containing 'parameter name'->'value'
mapping to be passed to kernel command line.
@@ -423,6 +423,15 @@ def _prepare_iso_image(task, kernel_href, ramdisk_href,
"building ISO, or explicit ISO for %(node)s") %
{'node': task.node.uuid})
+ # NOTE(rpittau): if base_iso is defined as http address, we just access
+ # it directly.
+ if base_iso and CONF.deploy.ramdisk_image_download_source == 'http':
+ if base_iso.startswith(('http://', 'https://')):
+ return base_iso
+ LOG.debug("ramdisk_image_download_source set to http but "
+ "boot_iso is not an HTTP URL: %(boot_iso)s",
+ {"boot_iso": base_iso})
+
img_handler = ImageHandler(task.node.driver)
k_param = img_handler.kernel_params