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
This commit is contained in:
parent
c14a366582
commit
1bb57ae116
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,4 +0,0 @@
|
||||
re ^(/tftpboot/) /tftpboot/\2
|
||||
re ^/tftpboot/ /tftpboot/
|
||||
re ^(^/) /tftpboot/\1
|
||||
re ^([^/]) /tftpboot/\1
|
4
docker/ironic/ironic-pxe/tftp-map-file-template
Normal file
4
docker/ironic/ironic-pxe/tftp-map-file-template
Normal file
@ -0,0 +1,4 @@
|
||||
re ^(${TFTPBOOT_PATH}/) ${TFTPBOOT_PATH}/\2
|
||||
re ^${TFTPBOOT_PATH}/ ${TFTPBOOT_PATH}/
|
||||
re ^(^/) ${TFTPBOOT_PATH}/\1
|
||||
re ^([^/]) ${TFTPBOOT_PATH}/\1
|
Loading…
Reference in New Issue
Block a user