diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2 index afcc5b30b1..19544f4a4e 100644 --- a/docker/base/Dockerfile.j2 +++ b/docker/base/Dockerfile.j2 @@ -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 \ diff --git a/docker/cinder/cinder-volume/Dockerfile.j2 b/docker/cinder/cinder-volume/Dockerfile.j2 index 7a98145ef6..66fa38d56b 100644 --- a/docker/cinder/cinder-volume/Dockerfile.j2 +++ b/docker/cinder/cinder-volume/Dockerfile.j2 @@ -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 diff --git a/docker/cinder/cinder-volume/cinder_sudoers b/docker/cinder/cinder-volume/cinder_sudoers new file mode 100644 index 0000000000..f3bec8b134 --- /dev/null +++ b/docker/cinder/cinder-volume/cinder_sudoers @@ -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 diff --git a/docker/cinder/cinder-volume/extend_start.sh b/docker/cinder/cinder-volume/extend_start.sh new file mode 100644 index 0000000000..67e8661435 --- /dev/null +++ b/docker/cinder/cinder-volume/extend_start.sh @@ -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 diff --git a/docker/iscsid/Dockerfile.j2 b/docker/iscsid/Dockerfile.j2 new file mode 100644 index 0000000000..fef7a87efe --- /dev/null +++ b/docker/iscsid/Dockerfile.j2 @@ -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 }} diff --git a/docker/nova/nova-compute/Dockerfile.j2 b/docker/nova/nova-compute/Dockerfile.j2 index 48337e9da4..c10624deb1 100644 --- a/docker/nova/nova-compute/Dockerfile.j2 +++ b/docker/nova/nova-compute/Dockerfile.j2 @@ -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 diff --git a/docker/tgtd/Dockerfile.j2 b/docker/tgtd/Dockerfile.j2 new file mode 100644 index 0000000000..03b04e83f0 --- /dev/null +++ b/docker/tgtd/Dockerfile.j2 @@ -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 }}