diff options
| author | Zuul <zuul@review.opendev.org> | 2022-04-06 10:28:43 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2022-04-06 10:28:43 +0000 |
| commit | 3f243ff99960b8c7a6b234b4d468a524cf15ff2f (patch) | |
| tree | b039db7d66655ce70a25fc4dd3528d3fd8ca27b7 /docker | |
| parent | e38db4973d39b348ac7e0bb53f96721cd9befbb6 (diff) | |
| parent | 1bb57ae116b4b8931bfcd512038b436f77c67e0c (diff) | |
| download | kolla-3f243ff99960b8c7a6b234b4d468a524cf15ff2f.tar.gz kolla-3f243ff99960b8c7a6b234b4d468a524cf15ff2f.zip | |
Merge "ironic: make tftpboot and httpboot paths configurable"14.0.0.0rc1
Diffstat (limited to 'docker')
| -rw-r--r-- | docker/ironic/ironic-pxe/Dockerfile.j2 | 4 | ||||
| -rw-r--r-- | docker/ironic/ironic-pxe/extend_start.sh | 45 | ||||
| -rw-r--r-- | docker/ironic/ironic-pxe/tftp-map-file | 4 | ||||
| -rw-r--r-- | docker/ironic/ironic-pxe/tftp-map-file-template | 4 |
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 |
