From f92151465b84164933e7660d9a9e91da9226bd5a Mon Sep 17 00:00:00 2001 From: Qiu Yu Date: Thu, 21 Jan 2016 01:20:02 -0700 Subject: [PATCH] Fix cinder create volume from image with kolla source build After recent drop root changes, all cinder rootwrap calls will fail in source build because lack of sudoer setting. This change adds sudoer file to enable rootwrap. It also add missing package dependencies needed for volume from image in source build type. Change-Id: I63a2405fb962ac687cdd88c81e1cdc02b3da638d Closes-Bug: #1536514 --- docker/cinder/cinder-base/Dockerfile.j2 | 9 ++++++++- docker/cinder/cinder-base/cinder_sudoers | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 docker/cinder/cinder-base/cinder_sudoers diff --git a/docker/cinder/cinder-base/Dockerfile.j2 b/docker/cinder/cinder-base/Dockerfile.j2 index a679a0b820..5fecd137d4 100644 --- a/docker/cinder/cinder-base/Dockerfile.j2 +++ b/docker/cinder/cinder-base/Dockerfile.j2 @@ -17,13 +17,16 @@ RUN yum -y install openstack-cinder \ {% elif install_type == 'source' %} {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} -RUN yum -y install lvm2 \ +RUN yum -y install \ + lvm2 \ + qemu-img \ && yum clean all {% elif base_distro in ['ubuntu', 'debian'] %} RUN apt-get install -y --no-install-recommends \ lvm2 \ + qemu-utils \ ceph-common \ && apt-get clean \ && mkdir -p /etc/ceph @@ -38,6 +41,10 @@ RUN ln -s cinder-base-source/* cinder \ && cp -r /cinder/etc/cinder/* /etc/cinder/ \ && chown -R cinder: /etc/cinder /var/log/cinder /var/lib/cinder /home/cinder +COPY cinder_sudoers /etc/sudoers.d/cinder_sudoers +RUN chmod 750 /etc/sudoers.d \ + && chmod 440 /etc/sudoers.d/cinder_sudoers + {% endif %} RUN usermod -a -G kolla cinder diff --git a/docker/cinder/cinder-base/cinder_sudoers b/docker/cinder/cinder-base/cinder_sudoers new file mode 100644 index 0000000000..3750f31a0d --- /dev/null +++ b/docker/cinder/cinder-base/cinder_sudoers @@ -0,0 +1 @@ +cinder ALL = (root) NOPASSWD: /var/lib/kolla/venv/bin/cinder-rootwrap /etc/cinder/rootwrap.conf *