Skip to content
Snippets Groups Projects
Commit 99cf9465 authored by Paul Bourke's avatar Paul Bourke
Browse files

Customizations for Cinder

Implement the new Jinja2 based templating patterns for Cinder, as
outlined in the below blueprint.

Change-Id: I8d0131aff9cc406bd80ce384003308aee672412a
Partially-implements: blueprint third-party-plugin-support
parent 495a905b
No related branches found
No related tags found
No related merge requests found
FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }}
MAINTAINER {{ maintainer }} MAINTAINER {{ maintainer }}
{% import "macros.j2" as macros with context %}
{% if install_type == 'binary' %} {% if install_type == 'binary' %}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum -y install \ {% set cinder_api_packages = [
python-keystone \ 'python-keystone'
&& yum clean all ] %}
{% elif base_distro in ['ubuntu'] %} {% elif base_distro in ['ubuntu'] %}
RUN apt-get -y install --no-install-recommends \ {% set cinder_api_packages = [
cinder-api \ 'cinder-api'
&& apt-get clean ] %}
{% endif %} {% endif %}
RUN {{ macros.install_packages(cinder_api_packages | customizable("packages")) }}
{% endif %} {% endif %}
COPY extend_start.sh /usr/local/bin/kolla_cinder_extend_start COPY extend_start.sh /usr/local/bin/kolla_cinder_extend_start
RUN chmod 755 /usr/local/bin/kolla_cinder_extend_start RUN chmod 755 /usr/local/bin/kolla_cinder_extend_start
{% block cinder_api_footer %}{% endblock %}
{% block footer %}{% endblock %}
{{ include_footer }} {{ include_footer }}
USER cinder USER cinder
FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }}
MAINTAINER {{ maintainer }} MAINTAINER {{ maintainer }}
{% import "macros.j2" as macros with context %}
{% if install_type == 'binary' %} {% if install_type == 'binary' %}
{% if base_distro in ['ubuntu'] %} {% if base_distro in ['ubuntu'] %}
RUN apt-get -y install --no-install-recommends \ {% set cinder_backup_packages = [
cinder-backup \ 'cinder-backup'
&& apt-get clean ] %}
RUN {{ macros.install_packages(cinder_backup_packages | customizable("packages")) }}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% block cinder_backup_footer %}{% endblock %}
{% block footer %}{% endblock %}
{{ include_footer }} {{ include_footer }}
USER cinder USER cinder
FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }}
MAINTAINER {{ maintainer }} MAINTAINER {{ maintainer }}
{% import "macros.j2" as macros with context %}
{% if install_type == 'binary' %} {% if install_type == 'binary' %}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum -y install \ {% set cinder_base_packages = [
openstack-cinder \ 'openstack-cinder',
python-automaton \ 'python-automaton',
lvm2 \ 'lvm2',
ceph-common \ 'ceph-common'
&& yum clean all \ ] %}
&& mkdir -p /etc/ceph
{% elif base_distro in ['ubuntu'] %} {% elif base_distro in ['ubuntu'] %}
RUN apt-get -y install --no-install-recommends \ {% set cinder_base_packages = [
cinder-common \ 'cinder-common',
ceph-common \ 'ceph-common',
lvm2 \ 'lvm2'
&& apt-get clean \ ] %}
&& mkdir -p /etc/ceph
{% endif %} {% endif %}
RUN {{ macros.install_packages(cinder_base_packages | customizable("packages")) }}
{% elif install_type == 'source' %} {% elif install_type == 'source' %}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum -y install \ {% set cinder_base_packages = [
lvm2 \ 'lvm2',
qemu-img \ 'qemu-img',
ceph-common \ 'ceph-common'
&& yum clean all ] %}
{% elif base_distro in ['ubuntu', 'debian'] %} {% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get -y install --no-install-recommends \ {% set cinder_base_packages = [
lvm2 \ 'lvm2',
qemu-utils \ 'qemu-utils',
ceph-common \ 'ceph-common'
&& apt-get clean \ ] %}
&& mkdir -p /etc/ceph
{% endif %} {% endif %}
RUN {{ macros.install_packages(cinder_base_packages | customizable("packages")) }}
ADD cinder-base-archive /cinder-base-source ADD cinder-base-archive /cinder-base-source
RUN ln -s cinder-base-source/* cinder \ RUN ln -s cinder-base-source/* cinder \
&& useradd --user-group cinder \ && useradd --user-group cinder \
...@@ -57,7 +61,11 @@ COPY cinder_sudoers /etc/sudoers.d/kolla_cinder_sudoers ...@@ -57,7 +61,11 @@ COPY cinder_sudoers /etc/sudoers.d/kolla_cinder_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN usermod -a -G kolla cinder \ RUN usermod -a -G kolla cinder \
&& mkdir -p /etc/ceph \
&& chmod 750 /etc/sudoers.d \ && chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/kolla_cinder_sudoers \ && chmod 440 /etc/sudoers.d/kolla_cinder_sudoers \
&& touch /usr/local/bin/kolla_cinder_extend_start \ && touch /usr/local/bin/kolla_cinder_extend_start \
&& chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_cinder_extend_start && chmod 755 /usr/local/bin/kolla_extend_start /usr/local/bin/kolla_cinder_extend_start
{% block cinder_base_footer %}{% endblock %}
{% block footer %}{% endblock %}
FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }}
MAINTAINER {{ maintainer }} MAINTAINER {{ maintainer }}
{% import "macros.j2" as macros with context %}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum -y install \ {% set cinder_rpcbind_packages = [
nfs-utils \ 'nfs-utils',
nfs-utils-lib \ 'nfs-utils-lib'
&& yum clean all ] %}
{% elif base_distro in ['ubuntu', 'debian'] %} {% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get -y install --no-install-recommends \ {% set cinder_rpcbind_packages = [
rpcbind \ 'rpcbind'
&& apt-get clean ] %}
{% endif %} {% endif %}
RUN {{ macros.install_packages(cinder_rpcbind_packages | customizable("packages")) }}
{% block cinder_rpcbind_footer %}{% endblock %}
{% block footer %}{% endblock %}
{{ include_footer }} {{ include_footer }}
USER cinder USER cinder
FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }}
MAINTAINER {{ maintainer }} MAINTAINER {{ maintainer }}
{% import "macros.j2" as macros with context %}
{% if install_type == 'binary' %} {% if install_type == 'binary' %}
{% if base_distro in ['ubuntu'] %} {% if base_distro in ['ubuntu'] %}
RUN apt-get -y install --no-install-recommends \ {% set cinder_scheduler_packages = [
cinder-scheduler \ 'cinder-scheduler'
&& apt-get clean ] %}
RUN {{ macros.install_packages(cinder_scheduler_packages | customizable("packages")) }}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% block cinder_scheduler_footer %}{% endblock %}
{% block footer %}{% endblock %}
{{ include_footer }} {{ include_footer }}
USER cinder USER cinder
FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }}
MAINTAINER {{ maintainer }} MAINTAINER {{ maintainer }}
{% import "macros.j2" as macros with context %}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum -y install \ {% set cinder_volume_packages = [
scsi-target-utils \ 'scsi-target-utils'
&& yum clean all ] %}
RUN {{ macros.install_packages(cinder_volume_packages | customizable("packages")) }}
{% block cinder_volume_redhat_setup %}
RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/tgtd.conf RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/tgtd.conf
{% endblock %}
{% elif base_distro in ['ubuntu', 'debian'] %} {% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get -y install --no-install-recommends \ {% set cinder_volume_packages = [
tgt \ 'tgt'
&& apt-get clean ] %}
RUN {{ macros.install_packages(cinder_volume_packages | customizable("packages")) }}
{% block cinder_volume_ubuntu_setup %}
RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/targets.conf RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/targets.conf
{% endblock %}
{% endif %} {% endif %}
{% if install_type == 'binary' %} {% if install_type == 'binary' %}
{% if base_distro in ['ubuntu', 'debian'] %} {% if base_distro in ['ubuntu', 'debian'] %}
RUN apt-get -y install --no-install-recommends \ {% set cinder_volume_packages = [
cinder-volume \ 'cinder-volume'
&& apt-get clean ] %}
{% endif %} RUN {{ macros.install_packages(cinder_volume_packages | customizable("packages")) }}
{% endif %}
{% endif %} {% endif %}
COPY cinder_sudoers /etc/sudoers.d/cinder_sudoers COPY cinder_sudoers /etc/sudoers.d/cinder_sudoers
...@@ -35,6 +48,8 @@ RUN chmod 750 /etc/sudoers.d \ ...@@ -35,6 +48,8 @@ RUN chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/cinder_sudoers \ && chmod 440 /etc/sudoers.d/cinder_sudoers \
&& chmod 755 /usr/local/bin/kolla_extend_start && chmod 755 /usr/local/bin/kolla_extend_start
{% block cinder_volume_footer %}{% endblock %}
{% block footer %}{% endblock %}
{{ include_footer }} {{ include_footer }}
USER cinder USER cinder
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment