From 793d68a29ca0a3724714b27441ddd87ecbe0e44d Mon Sep 17 00:00:00 2001 From: Ryan Hallisey Date: Tue, 14 Apr 2015 11:39:38 -0400 Subject: [PATCH] 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 Co-Authored-By: Ian Main Implements: blueprint cinder-container Closes-bug: #1460136 Change-Id: I688471151ffa54d547b9aa0f2f2e2ea7f68f288d --- .../binary/cinder-app/cinder-api/Dockerfile | 6 + .../centos/binary/cinder-app/cinder-api/build | 1 + .../binary/cinder-app/cinder-api/check.sh | 16 ++ .../binary/cinder-app/cinder-api/start.sh | 73 +++++++++ .../cinder-app/cinder-backup/Dockerfile | 6 + .../binary/cinder-app/cinder-backup/build | 1 + .../binary/cinder-app/cinder-backup/start.sh | 36 +++++ .../cinder-base}/Dockerfile | 3 +- .../binary/cinder-app/cinder-base/build | 1 + .../cinder-app/cinder-base/config-cinder.sh | 132 ++++++++++++++++ .../cinder-app/cinder-scheduler/Dockerfile | 6 + .../binary/cinder-app/cinder-scheduler/build | 1 + .../cinder-app/cinder-scheduler/start.sh | 32 ++++ .../cinder-app/cinder-volume/Dockerfile | 17 ++ .../binary/cinder-app/cinder-volume/build | 1 + .../binary/cinder-app/cinder-volume/start.sh | 75 +++++++++ .../cinder-volume/volume-group-create.sh | 22 +++ docker/centos/binary/cinder-data/Dockerfile | 9 ++ .../binary/{cinder => cinder-data}/build | 0 docker/centos/binary/cinder/start.sh | 145 ------------------ 20 files changed, 436 insertions(+), 147 deletions(-) create mode 100644 docker/centos/binary/cinder-app/cinder-api/Dockerfile create mode 120000 docker/centos/binary/cinder-app/cinder-api/build create mode 100755 docker/centos/binary/cinder-app/cinder-api/check.sh create mode 100755 docker/centos/binary/cinder-app/cinder-api/start.sh create mode 100644 docker/centos/binary/cinder-app/cinder-backup/Dockerfile create mode 120000 docker/centos/binary/cinder-app/cinder-backup/build create mode 100755 docker/centos/binary/cinder-app/cinder-backup/start.sh rename docker/centos/binary/{cinder => cinder-app/cinder-base}/Dockerfile (77%) create mode 120000 docker/centos/binary/cinder-app/cinder-base/build create mode 100644 docker/centos/binary/cinder-app/cinder-base/config-cinder.sh create mode 100644 docker/centos/binary/cinder-app/cinder-scheduler/Dockerfile create mode 120000 docker/centos/binary/cinder-app/cinder-scheduler/build create mode 100755 docker/centos/binary/cinder-app/cinder-scheduler/start.sh create mode 100644 docker/centos/binary/cinder-app/cinder-volume/Dockerfile create mode 120000 docker/centos/binary/cinder-app/cinder-volume/build create mode 100755 docker/centos/binary/cinder-app/cinder-volume/start.sh create mode 100755 docker/centos/binary/cinder-app/cinder-volume/volume-group-create.sh create mode 100644 docker/centos/binary/cinder-data/Dockerfile rename docker/centos/binary/{cinder => cinder-data}/build (100%) delete mode 100755 docker/centos/binary/cinder/start.sh diff --git a/docker/centos/binary/cinder-app/cinder-api/Dockerfile b/docker/centos/binary/cinder-app/cinder-api/Dockerfile new file mode 100644 index 0000000000..6fcb41eecc --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-api/Dockerfile @@ -0,0 +1,6 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +COPY ./start.sh ./check.sh / + +CMD ["/start.sh"] diff --git a/docker/centos/binary/cinder-app/cinder-api/build b/docker/centos/binary/cinder-app/cinder-api/build new file mode 120000 index 0000000000..ec19138031 --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-api/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image \ No newline at end of file diff --git a/docker/centos/binary/cinder-app/cinder-api/check.sh b/docker/centos/binary/cinder-app/cinder-api/check.sh new file mode 100755 index 0000000000..57b88f5669 --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-api/check.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +RES=0 + +. /openrc +if ! keystone token-get > /dev/null; then + echo "ERROR: keystone token-get failed" >&2 + RES=1 +else + if ! cinder list > /dev/null; then + echo "ERROR: cinder list failed" >&2 + RES=1 + fi +fi + +exit $RES diff --git a/docker/centos/binary/cinder-app/cinder-api/start.sh b/docker/centos/binary/cinder-app/cinder-api/start.sh new file mode 100755 index 0000000000..28293ac6cc --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-api/start.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-cinder.sh + +check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_ADMIN_SERVICE_HOST \ + ADMIN_TENANT_NAME PUBLIC_IP CINDER_API_SERVICE_HOST \ + KEYSTONE_AUTH_PROTOCOL KEYSTONE_ADMIN_SERVICE_PORT \ + CINDER_KEYSTONE_USER CINDER_KEYSTONE_PASSWORD \ + CINDER_API_LOG_FILE CINDER_API_SERVICE_LISTEN \ + CINDER_API_SERVICE_PORT CINDER_API_SERVICE_LISTEN + +fail_unless_os_service_running keystone + +cfg=/etc/cinder/cinder.conf + +# Set the auth credentials +export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}" +export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_ADMIN_SERVICE_HOST}:${KEYSTONE_ADMIN_SERVICE_PORT}/v2.0" + +# Create Keystone User +crux user-create --update \ + -n "${CINDER_KEYSTONE_USER}" \ + -p "${CINDER_KEYSTONE_PASSWORD}" \ + -t "${ADMIN_TENANT_NAME}" \ + -r admin + +# Configure Keystone +crux endpoint-create --remove-all \ + -n cinder \ + -t volume \ + -P "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v1/\$(tenant_id)s" \ + -A "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v1/\$(tenant_id)s" \ + -I "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v1/\$(tenant_id)s" + +crux endpoint-create --remove-all \ + -n cinderv2 \ + -t volumev2 \ + -P "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \ + -A "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" \ + -I "http://${CINDER_API_SERVICE_HOST}:${CINDER_API_SERVICE_PORT}/v2/\$(tenant_id)s" + +# Logging +crudini --set $cfg \ + DEFAULT \ + log_file \ + "${CINDER_API_LOG_FILE}" + +# API Configuration +crudini --set $cfg \ + DEFAULT \ + osapi_volume_listen \ + "${CINDER_API_SERVICE_LISTEN}" + +crudini --set $cfg \ + DEFAULT \ + osapi_volume_listen_port \ + "${CINDER_API_SERVICE_PORT}" + +crudini --set $cfg \ + DEFAULT \ + enable_v1_api \ + "true" + +crudini --set $cfg \ + DEFAULT \ + enable_v2_api \ + "true" + +echo "Starting cinder-api" +exec /usr/bin/cinder-api --config-file $cfg diff --git a/docker/centos/binary/cinder-app/cinder-backup/Dockerfile b/docker/centos/binary/cinder-app/cinder-backup/Dockerfile new file mode 100644 index 0000000000..fb44155b30 --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-backup/Dockerfile @@ -0,0 +1,6 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%cinder-base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +COPY ./start.sh /start.sh + +CMD ["/start.sh"] diff --git a/docker/centos/binary/cinder-app/cinder-backup/build b/docker/centos/binary/cinder-app/cinder-backup/build new file mode 120000 index 0000000000..ec19138031 --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-backup/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image \ No newline at end of file diff --git a/docker/centos/binary/cinder-app/cinder-backup/start.sh b/docker/centos/binary/cinder-app/cinder-backup/start.sh new file mode 100755 index 0000000000..5dff79b356 --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-backup/start.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +. /opt/kolla/kolla-common.sh +. /opt/kolla/config-cinder.sh + +check_required_vars CINDER_BACKUP_DRIVER CINDER_BACKUP_MANAGER \ + CINDER_BACKUP_API_CLASS CINDER_BACKUP_NAME_TEMPLATE + +cfg=/etc/cinder/cinder.conf + +# volume backup configuration +crudini --set $cfg \ + DEFAULT \ + backup_driver \ + "${CINDER_BACKUP_DRIVER}" +crudini --set $cfg \ + DEFAULT \ + backup_topic \ + "cinder-backup" +crudini --set $cfg \ + DEFAULT \ + backup_manager \ + "${CINDER_BACKUP_MANAGER}" +crudini --set $cfg \ + DEFAULT \ + backup_api_class \ + "${CINDER_BACKUP_API_CLASS}" +crudini --set $cfg \ + DEFAULT \ + backup_name_template \ + "${CINDER_BACKUP_NAME_TEMPLATE}" + +echo "Starting cinder-backup" +exec /usr/bin/cinder-backup --config-file $cfg diff --git a/docker/centos/binary/cinder/Dockerfile b/docker/centos/binary/cinder-app/cinder-base/Dockerfile similarity index 77% rename from docker/centos/binary/cinder/Dockerfile rename to docker/centos/binary/cinder-app/cinder-base/Dockerfile index 3dd7eca59b..643f0645ba 100644 --- a/docker/centos/binary/cinder/Dockerfile +++ b/docker/centos/binary/cinder-app/cinder-base/Dockerfile @@ -3,6 +3,5 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla) RUN yum -y install openstack-cinder && yum clean all -ADD ./start.sh /start.sh -CMD ["/start.sh"] +COPY config-cinder.sh /opt/kolla/config-cinder.sh diff --git a/docker/centos/binary/cinder-app/cinder-base/build b/docker/centos/binary/cinder-app/cinder-base/build new file mode 120000 index 0000000000..ec19138031 --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-base/build @@ -0,0 +1 @@ +../../../../../tools/build-docker-image \ No newline at end of file diff --git a/docker/centos/binary/cinder-app/cinder-base/config-cinder.sh b/docker/centos/binary/cinder-app/cinder-base/config-cinder.sh new file mode 100644 index 0000000000..f82cb5510c --- /dev/null +++ b/docker/centos/binary/cinder-app/cinder-base/config-cinder.sh @@ -0,0 +1,132 @@ +#!/bin/sh + +set -e + +. /opt/kolla/kolla-common.sh + +check_required_vars CINDER_DB_PASSWORD CINDER_KEYSTONE_PASSWORD \ + KEYSTONE_PUBLIC_SERVICE_HOST RABBITMQ_SERVICE_HOST \ + GLANCE_API_SERVICE_HOST MARIADB_SERVICE_HOST \ + RABBITMQ_SERVICE_HOST RABBITMQ_SERVICE_PORT \ + RABBIT_USERID RABBIT_PASSWORD GLANCE_API_SERVICE_HOST \ + GLANCE_API_SERVICE_PORT ADMIN_TENANT_NAME \ + CINDER_DB_NAME CINDER_DB_USER CINDER_KEYSTONE_USER \ + PUBLIC_IP KEYSTONE_AUTH_PROTOCOL CINDER_LOG_DIR + +dump_vars + +cat > /openrc <