From 3a56ce182662bcc9cf753024275034907ea36032 Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Sun, 4 Oct 2015 03:58:27 +0000 Subject: [PATCH] PXE for Ironic for ubuntu This makes Ironic build properly from source. Change-Id: Ic61cd945760843aae1f0a01738bca3b818fd2f69 Closes-Bug: #1500577 --- docker/ironic/ironic-discoverd/Dockerfile.j2 | 6 ---- docker/ironic/ironic-pxe/Dockerfile.j2 | 37 +++++++++----------- docker/ironic/ironic-pxe/tftp-map-file | 4 +++ 3 files changed, 20 insertions(+), 27 deletions(-) create mode 100644 docker/ironic/ironic-pxe/tftp-map-file diff --git a/docker/ironic/ironic-discoverd/Dockerfile.j2 b/docker/ironic/ironic-discoverd/Dockerfile.j2 index 5e15c8d585..6dd9a68b35 100644 --- a/docker/ironic/ironic-discoverd/Dockerfile.j2 +++ b/docker/ironic/ironic-discoverd/Dockerfile.j2 @@ -11,12 +11,6 @@ RUN pip install ironic-discoverd # && yum clean all {% endif %} - -{% elif install_type == 'source' %} - -RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ - && /bin/false - {% endif %} COPY start.sh / diff --git a/docker/ironic/ironic-pxe/Dockerfile.j2 b/docker/ironic/ironic-pxe/Dockerfile.j2 index d4484d1dba..59e80e6df1 100644 --- a/docker/ironic/ironic-pxe/Dockerfile.j2 +++ b/docker/ironic/ironic-pxe/Dockerfile.j2 @@ -1,33 +1,28 @@ FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-base:{{ tag }} MAINTAINER Kolla Project (https://launchpad.net/kolla) -{% if install_type == 'binary' %} - {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} +{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install tftp-server syslinux-tftpboot \ - && yum clean all +RUN yum -y install \ + tftp-server \ + syslinux-tftpboot \ + && yum clean all \ + && mkdir -p /tftpboot \ + && cp /var/lib/tftpboot/chain.c32 /tftpboot -# PXE configuration -RUN mkdir -p /tftpboot \ - && cp /var/lib/tftpboot/chain.c32 /tftpboot \ - && echo 're ^(/tftpboot/) /tftpboot/\2' > /tftpboot/map-file \ - && echo 're ^/tftpboot/ /tftpboot/' >> /tftpboot/map-file \ - && echo 're ^(^/) /tftpboot/\1' >> /tftpboot/map-file \ - && echo 're ^([^/]) /tftpboot/\1' >> /tftpboot/map-file +{% elif base_distro in ['ubuntu', 'debian'] %} - {% elif base_distro in ['ubuntu', 'debian'] %} -RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ - && /bin/false - - {% endif %} - -{% elif install_type == 'source' %} - -RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ - && /bin/false +RUN apt-get install --no-install-recommends \ + tftpd-hpa \ + syslinux-common \ + pxelinux \ + && apt-get clean \ + && mkdir -p /tftpboot \ + && cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/chain.c32 /tftpboot {% endif %} +COPY tftp-map-file /tftpboot/map-file COPY start.sh / CMD ["/start.sh"] diff --git a/docker/ironic/ironic-pxe/tftp-map-file b/docker/ironic/ironic-pxe/tftp-map-file new file mode 100644 index 0000000000..812abe0c5c --- /dev/null +++ b/docker/ironic/ironic-pxe/tftp-map-file @@ -0,0 +1,4 @@ +re ^(/tftpboot/) /tftpboot/\2 +re ^/tftpboot/ /tftpboot/ +re ^(^/) /tftpboot/\1 +re ^([^/]) /tftpboot/\1