Adds iscsid and tgtd docker containers

This partially implements iscsi and lvm2 support for cinder
in Kolla. Adds iscsid and tgtd docker containers.

Change-Id: I7fb48c954e578772b90a2aa619c8bcfa990b3ae8
Partially-Implements: blueprint iscsi-lvm2-docker
This commit is contained in:
Serguei Bezverkhi 2016-03-31 10:02:48 -04:00
parent 3a028e4334
commit 184f01a0d6
7 changed files with 100 additions and 6 deletions

View File

@ -129,6 +129,9 @@ RUN yum install -y \
python-jinja2 \
python-kazoo \
python-six \
lvm2 \
scsi-target-utils \
iscsi-initiator-utils \
&& yum clean all
{% endif %}
@ -145,6 +148,9 @@ RUN yum -y install \
sudo \
tar \
which \
lvm2 \
scsi-target-utils \
iscsi-initiator-utils \
&& yum clean all
{% endif %}
@ -173,6 +179,9 @@ RUN apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 199369E540
python-kazoo \
python-six \
curl \
open-iscsi \
tgt \
lvm2 \
&& 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 \
&& rm -rf /usr/lib/python2.7/site-packages \

View File

@ -1,23 +1,31 @@
FROM {{ namespace }}/{{ image_prefix }}cinder-base:{{ tag }}
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 \
lvm2 \
scsi-target-utils \
&& 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 \
cinder-volume \
tgt \
&& apt-get clean
{% endif %}
RUN sed -i '1 i include /var/lib/cinder/volumes/*' /etc/tgt/targets.conf
{% 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 }}
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 \
ceph-common \
genisoimage \
iscsi-initiator-utils \
targetcli \
python-rtslib \
&& yum clean all
{% elif base_distro in ['ubuntu'] %}
@ -23,6 +26,9 @@ RUN apt-get install -y --no-install-recommends \
ironic-common \
python-ironicclient \
genisoimage \
open-iscsi \
targetcli \
python-rtslib \
&& apt-get clean \
&& rm -f /etc/nova/nova-compute.conf
@ -37,6 +43,9 @@ RUN yum -y install \
sysfsutils \
ceph-common \
genisoimage \
iscsi-initiator-utils \
targetcli \
python-rtslib \
&& yum clean all
{% elif base_distro in ['ubuntu', 'debian'] %}
@ -46,6 +55,9 @@ RUN apt-get install -y --no-install-recommends \
qemu-utils \
ceph-common \
genisoimage \
open-iscsi \
targetcli \
python-rtslib \
&& apt-get clean \
&& mkdir -p /etc/ceph
@ -62,6 +74,8 @@ RUN chmod 755 /usr/local/bin/kolla_nova_extend_start \
&& chmod 440 /etc/sudoers.d/nova_compute_sudoers \
&& rm -f /etc/machine-id
ENV PATH $PATH:/lib/udev
{{ include_footer }}
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 }}