aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorMark Goddard <mark@stackhpc.com>2022-04-05 09:31:06 +0100
committerRadosław Piliszek <radoslaw.piliszek@gmail.com>2022-04-05 19:46:10 +0000
commit1bb57ae116b4b8931bfcd512038b436f77c67e0c (patch)
tree6f9d1684449936c9939d017fb353ed73f2d29287 /docker
parentc14a366582da0bec621b103418da1668fce5f591 (diff)
downloadkolla-1bb57ae116b4b8931bfcd512038b436f77c67e0c.tar.gz
kolla-1bb57ae116b4b8931bfcd512038b436f77c67e0c.zip
ironic: make tftpboot and httpboot paths configurable
This is needed to support PXE and iPXE at the same time. We will move /tftpboot and /httpboot to /var/lib/ironic/. With these paths configurable via an environment variable, we can support a clean transition. This patch also cleans up pxelinux part, making it analogous to grub and ipxe parts. RHEL leftover mention is removed. Co-Authored-By: Radosław Piliszek <radoslaw.piliszek@gmail.com> Needed-By: https://review.opendev.org/c/openstack/kolla-ansible/+/832159 Change-Id: I1ae81217c8bbf606c903c8009a372662ca3ab08c
Diffstat (limited to 'docker')
-rw-r--r--docker/ironic/ironic-pxe/Dockerfile.j24
-rw-r--r--docker/ironic/ironic-pxe/extend_start.sh45
-rw-r--r--docker/ironic/ironic-pxe/tftp-map-file4
-rw-r--r--docker/ironic/ironic-pxe/tftp-map-file-template4
4 files changed, 33 insertions, 24 deletions
diff --git a/docker/ironic/ironic-pxe/Dockerfile.j2 b/docker/ironic/ironic-pxe/Dockerfile.j2
index f212e7f30..b9c1da51c 100644
--- a/docker/ironic/ironic-pxe/Dockerfile.j2
+++ b/docker/ironic/ironic-pxe/Dockerfile.j2
@@ -43,7 +43,9 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{{ macros.install_packages(ironic_pxe_packages | customizable("packages")) }}
{% endif %}
-COPY tftp-map-file /map-file
+ENV TFTPBOOT_PATH=/tftpboot \
+ HTTPBOOT_PATH=/httpboot
+COPY tftp-map-file-template /map-file-template
COPY extend_start.sh /usr/local/bin/kolla_ironic_extend_start
RUN chmod 755 /usr/local/bin/kolla_ironic_extend_start
diff --git a/docker/ironic/ironic-pxe/extend_start.sh b/docker/ironic/ironic-pxe/extend_start.sh
index 8d06a90c1..f82d6c3c7 100644
--- a/docker/ironic/ironic-pxe/extend_start.sh
+++ b/docker/ironic/ironic-pxe/extend_start.sh
@@ -3,14 +3,16 @@
# For x86 legacy BIOS boot mode
function prepare_pxe_pxelinux {
- chown -R ironic: /tftpboot
- for pxe_file in /var/lib/tftpboot/pxelinux.0 /var/lib/tftpboot/chain.c32 /usr/lib/syslinux/pxelinux.0 \
- /usr/lib/syslinux/chain.c32 /usr/lib/PXELINUX/pxelinux.0 \
- /usr/lib/syslinux/modules/bios/chain.c32 /usr/lib/syslinux/modules/bios/ldlinux.c32; do
- if [[ -e "$pxe_file" ]]; then
- cp "$pxe_file" /tftpboot
+ if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
+ cp /usr/lib/PXELINUX/pxelinux.0 \
+ /usr/lib/syslinux/modules/bios/{chain.c32,ldlinux.c32} \
+ ${TFTPBOOT_PATH}/
+ elif [[ "${KOLLA_BASE_DISTRO}" =~ centos ]]; then
+ if [[ "${TFTPBOOT_PATH}" != /tftpboot ]]; then
+ cp /tftpboot/{pxelinux.0,chain.c32,ldlinux.c32} \
+ ${TFTPBOOT_PATH}/
fi
- done
+ fi
}
# For UEFI boot mode
@@ -18,7 +20,7 @@ function prepare_pxe_grub {
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
shim_src_file="/usr/lib/shim/shim*64.efi.signed"
grub_src_file="/usr/lib/grub/*-efi-signed/grubnet*64.efi.signed"
- elif [[ "${KOLLA_BASE_DISTRO}" =~ centos|rhel ]]; then
+ elif [[ "${KOLLA_BASE_DISTRO}" =~ centos ]]; then
shim_src_file="/boot/efi/EFI/centos/shim*64.efi"
grub_src_file="/boot/efi/EFI/centos/grub*64.efi"
fi
@@ -31,8 +33,8 @@ function prepare_pxe_grub {
grub_dst_file="grubaa64.efi"
fi
- cp $shim_src_file /tftpboot/$shim_dst_file
- cp $grub_src_file /tftpboot/$grub_dst_file
+ cp $shim_src_file ${TFTPBOOT_PATH}/$shim_dst_file
+ cp $grub_src_file ${TFTPBOOT_PATH}/$grub_dst_file
}
function prepare_ipxe {
@@ -41,21 +43,21 @@ function prepare_ipxe {
# was ipxe.efi. Ensure that both exist, using symlinks where the files are
# named differently to allow the original names to be used in ironic.conf.
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
- cp /usr/lib/ipxe/{undionly.kpxe,ipxe.efi} /tftpboot
+ cp /usr/lib/ipxe/{undionly.kpxe,ipxe.efi} ${TFTPBOOT_PATH}/
# NOTE(mgoddard): The 'else' can be removed when snponly.efi is
# available in Jammy 22.04.
if [[ -f /usr/lib/ipxe/snponly.efi ]]; then
- cp /usr/lib/ipxe/snponly.efi /tftpboot/snponly.efi
- elif [[ ! -e /tftpboot/snponly.efi ]]; then
- ln -s /tftpboot/ipxe.efi /tftpboot/snponly.efi
+ cp /usr/lib/ipxe/snponly.efi ${TFTPBOOT_PATH}/snponly.efi
+ elif [[ ! -e ${TFTPBOOT_PATH}/snponly.efi ]]; then
+ ln -s ${TFTPBOOT_PATH}/ipxe.efi ${TFTPBOOT_PATH}/snponly.efi
fi
elif [[ "${KOLLA_BASE_DISTRO}" =~ centos ]]; then
- cp /usr/share/ipxe/{undionly.kpxe,ipxe*.efi} /tftpboot
- if [[ ! -e /tftpboot/ipxe.efi ]]; then
- ln -s /tftpboot/ipxe-${KOLLA_BASE_ARCH}.efi /tftpboot/ipxe.efi
+ cp /usr/share/ipxe/{undionly.kpxe,ipxe*.efi} ${TFTPBOOT_PATH}/
+ if [[ ! -e ${TFTPBOOT_PATH}/ipxe.efi ]]; then
+ ln -s ${TFTPBOOT_PATH}/ipxe-${KOLLA_BASE_ARCH}.efi ${TFTPBOOT_PATH}/ipxe.efi
fi
- if [[ ! -e /tftpboot/snponly.efi ]]; then
- ln -s /tftpboot/ipxe-snponly-${KOLLA_BASE_ARCH}.efi /tftpboot/snponly.efi
+ if [[ ! -e ${TFTPBOOT_PATH}/snponly.efi ]]; then
+ ln -s ${TFTPBOOT_PATH}/ipxe-snponly-${KOLLA_BASE_ARCH}.efi ${TFTPBOOT_PATH}/snponly.efi
fi
fi
}
@@ -63,10 +65,15 @@ function prepare_ipxe {
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
+ mkdir -p ${TFTPBOOT_PATH} ${HTTPBOOT_PATH}
+ chown ironic: ${TFTPBOOT_PATH} ${HTTPBOOT_PATH}
prepare_pxe_pxelinux
prepare_pxe_grub
prepare_ipxe
exit 0
fi
+# Template out a TFTP map file, using the TFTPBOOT_PATH variable.
+envsubst < /map-file-template > /map-file
+
. /usr/local/bin/kolla_httpd_setup
diff --git a/docker/ironic/ironic-pxe/tftp-map-file b/docker/ironic/ironic-pxe/tftp-map-file
deleted file mode 100644
index 812abe0c5..000000000
--- a/docker/ironic/ironic-pxe/tftp-map-file
+++ /dev/null
@@ -1,4 +0,0 @@
-re ^(/tftpboot/) /tftpboot/\2
-re ^/tftpboot/ /tftpboot/
-re ^(^/) /tftpboot/\1
-re ^([^/]) /tftpboot/\1
diff --git a/docker/ironic/ironic-pxe/tftp-map-file-template b/docker/ironic/ironic-pxe/tftp-map-file-template
new file mode 100644
index 000000000..5d3243a7e
--- /dev/null
+++ b/docker/ironic/ironic-pxe/tftp-map-file-template
@@ -0,0 +1,4 @@
+re ^(${TFTPBOOT_PATH}/) ${TFTPBOOT_PATH}/\2
+re ^${TFTPBOOT_PATH}/ ${TFTPBOOT_PATH}/
+re ^(^/) ${TFTPBOOT_PATH}/\1
+re ^([^/]) ${TFTPBOOT_PATH}/\1