diff options
| author | Ryan Hallisey <rhallise@redhat.com> | 2015-04-14 11:39:38 -0400 |
|---|---|---|
| committer | Ryan Hallisey <rhallise@redhat.com> | 2015-06-18 13:46:49 -0400 |
| commit | 793d68a29ca0a3724714b27441ddd87ecbe0e44d (patch) | |
| tree | dbf0dbc7ed6d8ca644430b53aa50f37934d400c7 /docker/centos/binary/cinder-app/cinder-volume | |
| parent | 0c5d6575ed7eb86886ae9e7e6ec693616db938d3 (diff) | |
| download | kolla-793d68a29ca0a3724714b27441ddd87ecbe0e44d.tar.gz kolla-793d68a29ca0a3724714b27441ddd87ecbe0e44d.zip | |
Cinder container
Cinder is going to be split up into four containers.
- cinder-api
- cinder-scheduler
- cinder-volume
- cinder-backup
Co-Authored-By: Daneyon Hansen <danehans@cisco.com>
Co-Authored-By: Ian Main <imain@redhat.com>
Implements: blueprint cinder-container
Closes-bug: #1460136
Change-Id: I688471151ffa54d547b9aa0f2f2e2ea7f68f288d
Diffstat (limited to 'docker/centos/binary/cinder-app/cinder-volume')
4 files changed, 115 insertions, 0 deletions
diff --git a/docker/centos/binary/cinder-app/cinder-volume/Dockerfile b/docker/centos/binary/cinder-app/cinder-volume/Dockerfile new file mode 100644 index 000000000..d82fed03c --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-volume/Dockerfile @@ -0,0 +1,17 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +# Install required packages +# https://bugs.launchpad.net/kolla/+bug/1460129 +# Iscsi will be removed from cinder-volume in a later patch +# so that we continue to follow the container best practices. +# There will also be other backends for cinder and iscsi should +# not be hardcoded here. +RUN yum install -y lvm2 scsi-target-utils && yum clean all + +# Add start scripts +COPY start.sh /start.sh +COPY volume-group-create.sh /opt/kolla/volume-group-create.sh + +# Start supervisor +CMD ["/start.sh"] diff --git a/docker/centos/binary/cinder-app/cinder-volume/build b/docker/centos/binary/cinder-app/cinder-volume/build new file mode 120000 index 000000000..ec1913803 --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-volume/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/cinder-app/cinder-volume/start.sh b/docker/centos/binary/cinder-app/cinder-volume/start.sh new file mode 100755 index 000000000..db29e75de --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-volume/start.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-cinder.sh +. /opt/kolla/volume-group-create.sh + +check_required_vars CINDER_VOLUME_API_LISTEN ISCSI_HELPER ISCSI_IP_ADDRESS \ + CINDER_VOLUME_GROUP CINDER_LVM_LO_VOLUME_SIZE \ + CINDER_VOLUME_BACKEND_NAME CINDER_VOLUME_DRIVER \ + CINDER_ENABLED_BACKEND CINDER_VOLUME_LOG_FILE + +cfg=/etc/cinder/cinder.conf + +# Logging +crudini --set $cfg \ + DEFAULT \ + log_file \ + "${CINDER_VOLUME_LOG_FILE}" + +# IP address on which OpenStack Volume API listens +crudini --set $cfg \ + DEFAULT \ + osapi_volume_listen \ + "${CINDER_VOLUME_API_LISTEN}" + +# The IP address that the iSCSI daemon is listening on +crudini --set $cfg \ + DEFAULT \ + iscsi_ip_address \ + "${ISCSI_IP_ADDRESS}" + +# Set to false when using loopback devices (testing) +crudini --set $cfg \ + DEFAULT \ + secure_delete \ + "false" + +crudini --set $cfg \ + DEFAULT \ + enabled_backends \ + "${CINDER_ENABLED_BACKEND}" + +crudini --set $cfg \ + lvm57 \ + iscsi_helper \ + "${ISCSI_HELPER}" + +crudini --set $cfg \ + lvm57 \ + volume_group \ + "${CINDER_VOLUME_GROUP}" + +crudini --set $cfg \ + lvm57 \ + volume_driver \ + "${CINDER_VOLUME_DRIVER}" + +crudini --set $cfg \ + lvm57 \ + iscsi_ip_address \ + "${ISCSI_IP_ADDRESS}" + +crudini --set $cfg \ + lvm57 \ + volume_backend_name \ + "${CINDER_VOLUME_BACKEND_NAME}" + +sed -i 's/udev_sync = 1/udev_sync = 0/' /etc/lvm/lvm.conf +sed -i 's/udev_rules = 1/udev_rules = 0/' /etc/lvm/lvm.conf +sed -i 's/use_lvmetad = 1/use_lvmetad = 0/' /etc/lvm/lvm.conf + +echo "Starting cinder-volume" +exec /usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf diff --git a/docker/centos/binary/cinder-app/cinder-volume/volume-group-create.sh b/docker/centos/binary/cinder-app/cinder-volume/volume-group-create.sh new file mode 100755 index 000000000..908d987b0 --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-volume/volume-group-create.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# The script will create the cinder-volume volume group that will +# allow cinder to create volumes from a backing file. +# This is based off devstack. +set -e + +backing_file=/opt/data/cinder_volume + +check_required_vars CINDER_LVM_LO_VOLUME_SIZE CINDER_VOLUME_GROUP + +if ! vgs ${CINDER_VOLUME_GROUP}; then + [[ ! -f $backing_file ]] && truncate -s ${CINDER_LVM_LO_VOLUMES_SIZE} $backing_file + vg_dev=`losetup -f --show $backing_file` + if ! vgs ${CINDER_VOLUME_GROUP}; then + vgcreate ${CINDER_VOLUME_GROUP} $vg_dev + fi +fi + +# Remove iscsi targets +cinder-rtstool get-targets | xargs -rn 1 cinder-rtstool delete + |
