Merge "Adds iscsid and tgtd docker containers"

This commit is contained in:
Jenkins 2016-04-12 19:38:45 +00:00 committed by Gerrit Code Review
commit 544c00b497
7 changed files with 100 additions and 6 deletions

View File

@ -140,6 +140,9 @@ RUN yum install -y \
python-jinja2 \ python-jinja2 \
python-kazoo \ python-kazoo \
python-six \ python-six \
lvm2 \
scsi-target-utils \
iscsi-initiator-utils \
&& yum clean all && yum clean all
{% endif %} {% endif %}
@ -156,6 +159,9 @@ RUN yum -y install \
sudo \ sudo \
tar \ tar \
which \ which \
lvm2 \
scsi-target-utils \
iscsi-initiator-utils \
&& yum clean all && yum clean all
{% endif %} {% endif %}
@ -187,6 +193,9 @@ RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 199369E540
python-kazoo \ python-kazoo \
python-six \ python-six \
curl \ curl \
open-iscsi \
tgt \
lvm2 \
&& apt-get clean \ && apt-get clean \
&& sed -i "s|'purelib': '\$base/local/lib/python\$py_version_short/dist-packages',|'purelib': '\$base/lib/python\$py_version_short/dist-packages',|;s|'platlib': '\$platbase/local/lib/python\$py_version_short/dist-packages',|'platlib': '\$platbase/lib/python\$py_version_short/dist-packages',|;s|'headers': '\$base/local/include/python\$py_version_short/\$dist_name',|'headers': '\$base/include/python\$py_version_short/\$dist_name',|;s|'scripts': '\$base/local/bin',|'scripts': '\$base/bin',|;s|'data' : '\$base/local',|'data' : '\$base',|" /usr/lib/python2.7/distutils/command/install.py \ && sed -i "s|'purelib': '\$base/local/lib/python\$py_version_short/dist-packages',|'purelib': '\$base/lib/python\$py_version_short/dist-packages',|;s|'platlib': '\$platbase/local/lib/python\$py_version_short/dist-packages',|'platlib': '\$platbase/lib/python\$py_version_short/dist-packages',|;s|'headers': '\$base/local/include/python\$py_version_short/\$dist_name',|'headers': '\$base/include/python\$py_version_short/\$dist_name',|;s|'scripts': '\$base/local/bin',|'scripts': '\$base/bin',|;s|'data' : '\$base/local',|'data' : '\$base',|" /usr/lib/python2.7/distutils/command/install.py \
&& rm -rf /usr/lib/python2.7/site-packages \ && rm -rf /usr/lib/python2.7/site-packages \

View File

@ -1,23 +1,31 @@
FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }} FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }}
MAINTAINER {{ maintainer }} MAINTAINER {{ maintainer }}
{% if install_type == 'binary' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum install -y \ RUN yum install -y \
lvm2 \
scsi-target-utils \ scsi-target-utils \
&& yum clean all && yum clean all
{% elif base_distro in ['ubuntu'] %} RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/tgtd.conf
{% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get install -y --no-install-recommends \ RUN apt-get install -y --no-install-recommends \
cinder-volume \ tgt \
&& apt-get clean && apt-get clean
{% endif %} RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/targets.conf
{% endif %} {% endif %}
COPY cinder_sudoers /etc/sudoers.d/cinder_sudoers
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 750 /etc/sudoers.d \
&& chmod 440 /etc/sudoers.d/cinder_sudoers \
&& chmod 755 /usr/local/bin/kolla_extend_start
{{ include_footer }} {{ include_footer }}
USER cinder USER cinder

View File

@ -0,0 +1,5 @@
cinder ALL = (root) NOPASSWD: /var/lib/kolla/venv/bin/cinder-rootwrap /etc/cinder/rootwrap.conf *
%kolla ALL=(root) NOPASSWD: /bin/chown -R cinder\:kolla /var/lib/cinder, /usr/bin/chown -R cinder\:kolla /var/lib/cinder
%kolla ALL=(root) NOPASSWD: /bin/chmod 2775 /var/lib/cinder, /usr/bin/chmod 2775 /var/lib/cinder
%kolla ALL=(root) NOPASSWD: /bin/chown -R cinder\:kolla /etc/iscsi, /usr/bin/chown -R cinder\:kolla /etc/iscsi
%kolla ALL=(root) NOPASSWD: /bin/chmod 2775 /etc/iscsi, /usr/bin/chmod 2775 /etc/iscsi

View File

@ -0,0 +1,14 @@
#!/bin/bash
if [[ $(stat -c %U:%G /var/lib/cinder) != "cinder:kolla" ]]; then
sudo chown -R cinder:kolla /var/lib/cinder
fi
if [[ $(stat -c %a /var/lib/cinder) != "2775" ]]; then
sudo chmod 2775 /var/lib/cinder
fi
if [[ $(stat -c %U:%G /etc/iscsi) != "cinder:kolla" ]]; then
sudo chown -R cinder:kolla /etc/iscsi
fi
if [[ $(stat -c %a /etc/iscsi) != "2775" ]]; then
sudo chmod 2775 /etc/iscsi
fi

View File

@ -0,0 +1,22 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
MAINTAINER {{ maintainer }}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum install -y \
iscsi-initiator-utils \
targetcli \
python-rtslib \
&& yum clean all
{% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get install -y --no-install-recommends \
open-iscsi \
targetcli \
python-rtslib \
&& apt-get clean
{% endif %}
{{ include_footer }}

View File

@ -10,6 +10,9 @@ RUN yum -y install \
sysfsutils \ sysfsutils \
ceph-common \ ceph-common \
genisoimage \ genisoimage \
iscsi-initiator-utils \
targetcli \
python-rtslib \
&& yum clean all && yum clean all
{% elif base_distro in ['ubuntu'] %} {% elif base_distro in ['ubuntu'] %}
@ -23,6 +26,9 @@ RUN apt-get install -y --no-install-recommends \
ironic-common \ ironic-common \
python-ironicclient \ python-ironicclient \
genisoimage \ genisoimage \
open-iscsi \
targetcli \
python-rtslib \
&& apt-get clean \ && apt-get clean \
&& rm -f /etc/nova/nova-compute.conf && rm -f /etc/nova/nova-compute.conf
@ -37,6 +43,9 @@ RUN yum -y install \
sysfsutils \ sysfsutils \
ceph-common \ ceph-common \
genisoimage \ genisoimage \
iscsi-initiator-utils \
targetcli \
python-rtslib \
&& yum clean all && yum clean all
{% elif base_distro in ['ubuntu', 'debian'] %} {% elif base_distro in ['ubuntu', 'debian'] %}
@ -46,6 +55,9 @@ RUN apt-get install -y --no-install-recommends \
qemu-utils \ qemu-utils \
ceph-common \ ceph-common \
genisoimage \ genisoimage \
open-iscsi \
targetcli \
python-rtslib \
&& apt-get clean \ && apt-get clean \
&& mkdir -p /etc/ceph && mkdir -p /etc/ceph
@ -59,6 +71,8 @@ COPY extend_start.sh /usr/local/bin/kolla_nova_extend_start
RUN chmod 755 /usr/local/bin/kolla_nova_extend_start \ RUN chmod 755 /usr/local/bin/kolla_nova_extend_start \
&& rm -f /etc/machine-id && rm -f /etc/machine-id
ENV PATH $PATH:/lib/udev
{{ include_footer }} {{ include_footer }}
USER nova USER nova

22
docker/tgtd/Dockerfile.j2 Normal file
View File

@ -0,0 +1,22 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
MAINTAINER {{ maintainer }}
{% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
RUN yum install -y \
scsi-target-utils \
&& yum clean all
RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/tgtd.conf
{% elif base_distro in ['ubuntu', 'debian'] %}
RUN apt-get install -y --no-install-recommends \
tgt \
&& apt-get clean
RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/targets.conf
{% endif %}
{{ include_footer }}