From d3c60d0035d62ece4277f59c40aabe570539face Mon Sep 17 00:00:00 2001 From: Paul Bourke Date: Fri, 5 Aug 2016 11:50:16 +0000 Subject: [PATCH] Customizations for Nova Change-Id: I7556d6cd473516c7ceb4aba7c1ba1130af2544ee Partially-implements: blueprint third-party-plugin-support --- docker/nova/nova-api/Dockerfile.j2 | 21 ++-- docker/nova/nova-base/Dockerfile.j2 | 63 ++++++----- docker/nova/nova-compute-ironic/Dockerfile.j2 | 20 ++-- docker/nova/nova-compute/Dockerfile.j2 | 102 ++++++++++-------- docker/nova/nova-conductor/Dockerfile.j2 | 19 ++-- docker/nova/nova-consoleauth/Dockerfile.j2 | 21 ++-- docker/nova/nova-libvirt/Dockerfile.j2 | 87 +++++++++------ docker/nova/nova-network/Dockerfile.j2 | 29 +++-- docker/nova/nova-novncproxy/Dockerfile.j2 | 21 ++-- docker/nova/nova-scheduler/Dockerfile.j2 | 19 ++-- .../nova/nova-spicehtml5proxy/Dockerfile.j2 | 24 +++-- docker/nova/nova-ssh/Dockerfile.j2 | 19 ++-- 12 files changed, 272 insertions(+), 173 deletions(-) diff --git a/docker/nova/nova-api/Dockerfile.j2 b/docker/nova/nova-api/Dockerfile.j2 index 485efb1d1d..1997b4c611 100644 --- a/docker/nova/nova-api/Dockerfile.j2 +++ b/docker/nova/nova-api/Dockerfile.j2 @@ -1,26 +1,33 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-nova-api \ - && yum clean all + {% set nova_api_packages = [ + 'openstack-nova-api' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - nova-api \ - python-memcache \ - && apt-get clean + {% set nova_api_packages = [ + 'nova-api', + 'python-memcache' + ] %} {% endif %} + +{{ macros.install_packages(nova_api_packages | customizable("packages")) }} + {% endif %} COPY extend_start.sh /usr/local/bin/kolla_nova_extend_start RUN chmod 755 /usr/local/bin/kolla_nova_extend_start +{% block nova_api_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER nova diff --git a/docker/nova/nova-base/Dockerfile.j2 b/docker/nova/nova-base/Dockerfile.j2 index 737e0294c8..b093a94e73 100644 --- a/docker/nova/nova-base/Dockerfile.j2 +++ b/docker/nova/nova-base/Dockerfile.j2 @@ -1,50 +1,57 @@ FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-nova-common \ - python-keystoneclient \ - python-cinderclient \ - bridge-utils \ - openvswitch \ - && yum clean all + {% set nova_base_packages = [ + 'openstack-nova-common', + 'python-keystoneclient', + 'python-cinderclient', + 'bridge-utils', + 'openvswitch' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - nova-common \ - python-nova \ - bridge-utils \ - openvswitch-switch \ - && apt-get clean + {% set nova_base_packages = [ + 'nova-common', + 'python-nova', + 'bridge-utils', + 'openvswitch-switch' + ] %} {% endif %} + +{{ macros.install_packages(nova_base_packages | customizable("packages")) }} + {% elif install_type == 'source' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - bridge-utils \ - openvswitch \ - && yum clean all + {% set nova_base_packages = [ + 'bridge-utils', + 'openvswitch' + ] %} {% elif base_distro in ['ubuntu', 'debian'] %} -RUN apt-get -y install --no-install-recommends \ - iptables \ - iproute2 \ - ebtables \ - dnsmasq \ - bridge-utils \ - python-libvirt \ - openssh-client \ - openvswitch-switch \ - && apt-get clean + {% set nova_base_packages = [ + 'iptables', + 'iproute2', + 'ebtables', + 'dnsmasq', + 'bridge-utils', + 'python-libvirt', + 'openssh-client', + 'openvswitch-switch' + ] %} {% endif %} +{{ macros.install_packages(nova_base_packages | customizable("packages")) }} + ADD nova-base-archive /nova-base-source RUN ln -s nova-base-source/* nova \ && useradd --user-group --create-home --home-dir /var/lib/nova nova \ @@ -67,3 +74,5 @@ RUN touch /usr/local/bin/kolla_nova_extend_start \ && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_nova_extend_start RUN usermod -a -G kolla nova + +{% block nova_base_footer %}{% endblock %} diff --git a/docker/nova/nova-compute-ironic/Dockerfile.j2 b/docker/nova/nova-compute-ironic/Dockerfile.j2 index 268cb67108..ace1259bdd 100644 --- a/docker/nova/nova-compute-ironic/Dockerfile.j2 +++ b/docker/nova/nova-compute-ironic/Dockerfile.j2 @@ -1,24 +1,32 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-nova-compute \ - && yum clean all + {% set nova_compute_ironic_packages = [ + 'openstack-nova-compute' + ] %} + +{{ macros.install_packages(nova_compute_ironic_packages | customizable("packages")) }} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - nova-compute \ - && apt-get clean + {% set nova_compute_ironic_packages = [ + 'nova-compute' + ] %} + +{{ macros.install_packages(nova_compute_ironic_packages | customizable("packages")) }} RUN rm /etc/nova/nova-compute.conf {% endif %} {% endif %} +{% block nova_compute_ironic_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER nova diff --git a/docker/nova/nova-compute/Dockerfile.j2 b/docker/nova/nova-compute/Dockerfile.j2 index 8e81f725db..3c5b5cc21a 100644 --- a/docker/nova/nova-compute/Dockerfile.j2 +++ b/docker/nova/nova-compute/Dockerfile.j2 @@ -1,68 +1,78 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-nova-compute \ - openvswitch \ - sysfsutils \ - ceph-common \ - genisoimage \ - iscsi-initiator-utils \ - targetcli \ - python-rtslib \ - && yum clean all + {% set nova_compute_packages = [ + 'openstack-nova-compute', + 'openvswitch', + 'sysfsutils', + 'ceph-common', + 'genisoimage', + 'iscsi-initiator-utils', + 'targetcli', + 'python-rtslib' + ] %} + +{{ macros.install_packages(nova_compute_packages | customizable("packages")) }} {% elif base_distro in ['ubuntu'] %} -# ironic as workaround https://bugs.launchpad.net/packstack/+bug/1430388 -RUN apt-get -y install --no-install-recommends \ - nova-compute \ - openvswitch-switch \ - sysfsutils \ - ceph-common \ - ironic-common \ - python-ironicclient \ - genisoimage \ - open-iscsi \ - targetcli \ - python-rtslib \ - && apt-get clean \ - && rm -f /etc/nova/nova-compute.conf + # ironic as workaround https://bugs.launchpad.net/packstack/+bug/1430388 + {% set nova_compute_packages = [ + 'nova-compute', + 'openvswitch-switch', + 'sysfsutils', + 'ceph-common', + 'ironic-common', + 'python-ironicclient', + 'genisoimage', + 'open-iscsi', + 'targetcli', + 'python-rtslib' + ] %} + +{{ macros.install_packages(nova_compute_packages | customizable("packages")) }} + +RUN rm -f /etc/nova/nova-compute.conf {% endif %} {% elif install_type == 'source' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - libvirt-devel \ - openvswitch \ - qemu-img \ - sysfsutils \ - ceph-common \ - genisoimage \ - iscsi-initiator-utils \ - targetcli \ - python-rtslib \ - && yum clean all + {% set nova_compute_packages = [ + 'libvirt-devel', + 'openvswitch', + 'qemu-img', + 'sysfsutils', + 'ceph-common', + 'genisoimage', + 'iscsi-initiator-utils', + 'targetcli', + 'python-rtslib' + ] %} {% elif base_distro in ['ubuntu', 'debian'] %} -RUN apt-get -y install --no-install-recommends \ - libvirt-dev \ - qemu-utils \ - ceph-common \ - genisoimage \ - open-iscsi \ - targetcli \ - python-rtslib \ - && apt-get clean \ - && mkdir -p /etc/ceph + {% set nova_compute_packages = [ + 'libvirt-dev', + 'qemu-utils', + 'ceph-common', + 'genisoimage', + 'open-iscsi', + 'targetcli', + 'python-rtslib' + ] %} + +RUN mkdir -p /etc/ceph {% endif %} +{{ macros.install_packages(nova_compute_packages | customizable("packages")) }} + RUN /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt libvirt-python {% endif %} @@ -73,6 +83,8 @@ RUN chmod 755 /usr/local/bin/kolla_nova_extend_start \ ENV PATH $PATH:/lib/udev +{% block nova_compute_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER nova diff --git a/docker/nova/nova-conductor/Dockerfile.j2 b/docker/nova/nova-conductor/Dockerfile.j2 index e53ba7e8f2..4bb5658aae 100644 --- a/docker/nova/nova-conductor/Dockerfile.j2 +++ b/docker/nova/nova-conductor/Dockerfile.j2 @@ -1,22 +1,29 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-nova-conductor \ - && yum clean all + {% set nova_conductor_packages = [ + 'openstack-nova-conductor' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - nova-conductor \ - && apt-get clean + {% set nova_conductor_packages = [ + 'nova-conductor' + ] %} {% endif %} + +{{ macros.install_packages(nova_conductor_packages | customizable("packages")) }} + {% endif %} +{% block nova_conductor_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER nova diff --git a/docker/nova/nova-consoleauth/Dockerfile.j2 b/docker/nova/nova-consoleauth/Dockerfile.j2 index c2c04783bf..9b2205c8e4 100644 --- a/docker/nova/nova-consoleauth/Dockerfile.j2 +++ b/docker/nova/nova-consoleauth/Dockerfile.j2 @@ -1,23 +1,30 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-nova-console \ - && yum clean all + {% set nova_consoleauth_packages = [ + 'openstack-nova-console' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - nova-consoleauth \ - python-memcache \ - && apt-get clean + {% set nova_consoleauth_packages = [ + 'nova-consoleauth', + 'python-memcache' + ] %} {% endif %} + +{{ macros.install_packages(nova_consoleauth_packages | customizable("packages")) }} + {% endif %} +{% block nova_consoleauth_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER nova diff --git a/docker/nova/nova-libvirt/Dockerfile.j2 b/docker/nova/nova-libvirt/Dockerfile.j2 index ab87a6900c..9bc485fc9d 100644 --- a/docker/nova/nova-libvirt/Dockerfile.j2 +++ b/docker/nova/nova-libvirt/Dockerfile.j2 @@ -1,47 +1,64 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} -{% set libvirt_group = 'libvirtd' %} +{% import "macros.j2" as macros with context %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - libvirt-daemon \ - libguestfs \ - qemu-system-x86 \ - libvirt-daemon-driver-nwfilter \ - libvirt-daemon-config-nwfilter \ - libvirt-daemon-driver-lxc \ - ceph-common \ - && yum clean all \ - && usermod -a -G nova qemu + {% set nova_libvirt_packages = [ + 'libvirt-daemon', + 'libguestfs', + 'qemu-system-x86', + 'libvirt-daemon-driver-nwfilter', + 'libvirt-daemon-config-nwfilter', + 'libvirt-daemon-driver-lxc', + 'ceph-common' + ] %} +{% elif base_distro == 'ubuntu' %} + + {% set nova_libvirt_packages = [ + 'ceph-common', + 'libvirt-bin', + 'dmidecode', + 'pm-utils', + 'qemu', + 'qemu-block-extra', + 'ebtables', + 'xen-utils-4.6' + ] %} + + {% set libvirt_group = 'libvirtd' %} + +{% elif base_distro == 'debian' %} + + {% set nova_libvirt_packages = [ + 'ceph-common', + 'libvirt-bin', + 'dmidecode', + 'pm-utils', + 'qemu', + 'qemu-block-extra', + 'ebtables', + 'xen-utils-4.4', + 'usermode' + ] %} + + {% set libvirt_group = 'libvirt' %} + +{% endif %} + +{{ macros.install_packages(nova_libvirt_packages | customizable("packages")) }} + +{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} + +RUN usermod -a -G nova qemu {% elif base_distro in ['ubuntu', 'debian'] %} -{% if base_distro == 'ubuntu' %} -{% set packages = - ' xen-utils-4.6' -%} -{% elif base_distro == 'debian' %} -{% set packages = - ' xen-utils-4.4 usermode' -%} -{% set libvirt_group = 'libvirt' %} -{% endif %} - -RUN apt-get -y install --no-install-recommends \ - ceph-common \ - libvirt-bin \ - dmidecode \ - pm-utils \ - qemu \ - qemu-block-extra \ - ebtables \ - {{ packages }} \ - && apt-get clean \ - && mkdir -p /etc/ceph \ - && rm -f /etc/libvirt/qemu/networks/default.xml /etc/libvirt/qemu/networks/autostart/default.xml \ +RUN mkdir -p /etc/ceph \ + && rm -f /etc/libvirt/qemu/networks/default.xml \ + /etc/libvirt/qemu/networks/autostart/default.xml \ && usermod -a -G {{ libvirt_group }} nova {% endif %} @@ -49,4 +66,6 @@ RUN apt-get -y install --no-install-recommends \ COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN chmod 755 /usr/local/bin/kolla_extend_start +{% block nova_libvirt_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} diff --git a/docker/nova/nova-network/Dockerfile.j2 b/docker/nova/nova-network/Dockerfile.j2 index 6b78b8ba47..5baa132a08 100644 --- a/docker/nova/nova-network/Dockerfile.j2 +++ b/docker/nova/nova-network/Dockerfile.j2 @@ -1,32 +1,39 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-nova-network \ - bridge-utils \ - initscripts \ - && yum clean all + {% set nova_network_packages = [ + 'openstack-nova-network', + 'bridge-utils', + 'initscripts' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - nova-network \ - && apt-get clean + {% set nova_network_packages = [ + 'nova-network' + ] %} {% endif %} {% elif install_type == 'source' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - initscripts \ - && yum clean all + {% set nova_network_packages = [ + 'initscripts' + ] %} {% endif %} + +{{ macros.install_packages(nova_network_packages | customizable("packages")) }} + {% endif %} +{% block nova_network_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER nova diff --git a/docker/nova/nova-novncproxy/Dockerfile.j2 b/docker/nova/nova-novncproxy/Dockerfile.j2 index 01fb62ce7d..78e78f2f66 100644 --- a/docker/nova/nova-novncproxy/Dockerfile.j2 +++ b/docker/nova/nova-novncproxy/Dockerfile.j2 @@ -1,21 +1,26 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - novnc \ - openstack-nova-novncproxy \ - && yum clean all + {% set nova_novncproxy_packages = [ + 'novnc', + 'openstack-nova-novncproxy' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - nova-novncproxy \ - && apt-get clean + {% set nova_novncproxy_packages = [ + 'nova-novncproxy' + ] %} {% endif %} + +{{ macros.install_packages(nova_novncproxy_packages | customizable("packages")) }} + {% elif install_type == 'source' %} ADD nova-novncproxy-archive /usr/share/nova-novncproxy-source @@ -25,6 +30,8 @@ RUN cd /usr/share \ {% endif %} +{% block nova_novncproxy_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER nova diff --git a/docker/nova/nova-scheduler/Dockerfile.j2 b/docker/nova/nova-scheduler/Dockerfile.j2 index ba6a3bf90f..97d205f2f6 100644 --- a/docker/nova/nova-scheduler/Dockerfile.j2 +++ b/docker/nova/nova-scheduler/Dockerfile.j2 @@ -1,22 +1,29 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-nova-scheduler \ - && yum clean all + {% set nova_scheduler_packages = [ + 'openstack-nova-scheduler' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - nova-scheduler \ - && apt-get clean + {% set nova_scheduler_packages = [ + 'nova-scheduler' + ] %} {% endif %} + +{{ macros.install_packages(nova_scheduler_packages | customizable("packages")) }} + {% endif %} +{% block nova_scheduler_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER nova diff --git a/docker/nova/nova-spicehtml5proxy/Dockerfile.j2 b/docker/nova/nova-spicehtml5proxy/Dockerfile.j2 index 420832014c..a6f76c2ec7 100644 --- a/docker/nova/nova-spicehtml5proxy/Dockerfile.j2 +++ b/docker/nova/nova-spicehtml5proxy/Dockerfile.j2 @@ -1,28 +1,36 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} +{% import "macros.j2" as macros with context %} + {% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install \ - openstack-nova-spicehtml5proxy \ - spice-html5 \ - && yum clean all + {% set nova_spicehtml5proxy_packages = [ + 'openstack-nova-spicehtml5proxy', + 'spice-html5' + ] %} {% elif base_distro in ['ubuntu'] %} -RUN apt-get -y install --no-install-recommends \ - nova-spiceproxy \ - && apt-get clean + {% set nova_spicehtml5proxy_packages = [ + 'nova-spiceproxy' + ] %} {% endif %} + +{{ macros.install_packages(nova_spicehtml5proxy_packages | customizable("packages")) }} + {% elif install_type == 'source' %} ADD nova-spicehtml5proxy-archive /usr/share/nova-spicehtml5proxy-source -RUN cd /usr/share && ln -s nova-spicehtml5proxy-source/* spice-html5 +RUN cd /usr/share \ + && ln -s nova-spicehtml5proxy-source/* spice-html5 {% endif %} +{% block nova_spicehtml5proxy_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }} USER nova diff --git a/docker/nova/nova-ssh/Dockerfile.j2 b/docker/nova/nova-ssh/Dockerfile.j2 index 132bd8f859..d3a433d5c3 100644 --- a/docker/nova/nova-ssh/Dockerfile.j2 +++ b/docker/nova/nova-ssh/Dockerfile.j2 @@ -1,23 +1,24 @@ FROM {{ namespace }}/{{ image_prefix }}nova-base:{{ tag }} MAINTAINER {{ maintainer }} -{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} +{% import "macros.j2" as macros with context %} -RUN yum -y install \ - openssh-server \ - && yum clean all +{% set nova_ssh_packages = [ + 'openssh-server' +] %} -{% elif base_distro in ['ubuntu', 'debian'] %} +{% if base_distro in ['ubuntu', 'debian'] %} -RUN apt-get -y install --no-install-recommends \ - openssh-server \ - && apt-get clean \ - && mkdir -p /var/run/sshd \ +RUN mkdir -p /var/run/sshd \ && chmod 0755 /var/run/sshd {% endif %} +{{ macros.install_packages(nova_ssh_packages | customizable("packages")) }} + COPY extend_start.sh /usr/local/bin/kolla_extend_start RUN chmod 755 /usr/local/bin/kolla_extend_start +{% block nova_ssh_footer %}{% endblock %} +{% block footer %}{% endblock %} {{ include_footer }}