aboutsummaryrefslogtreecommitdiff
path: root/docker/centos/binary/cinder-app/cinder-api
diff options
context:
space:
mode:
authorRyan Hallisey <rhallise@redhat.com>2015-04-14 11:39:38 -0400
committerRyan Hallisey <rhallise@redhat.com>2015-06-18 13:46:49 -0400
commit793d68a29ca0a3724714b27441ddd87ecbe0e44d (patch)
treedbf0dbc7ed6d8ca644430b53aa50f37934d400c7 /docker/centos/binary/cinder-app/cinder-api
parent0c5d6575ed7eb86886ae9e7e6ec693616db938d3 (diff)
downloadkolla-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-api')
-rw-r--r--docker/centos/binary/cinder-app/cinder-api/Dockerfile6
l---------docker/centos/binary/cinder-app/cinder-api/build1
-rwxr-xr-xdocker/centos/binary/cinder-app/cinder-api/check.sh16
-rwxr-xr-xdocker/centos/binary/cinder-app/cinder-api/start.sh73
4 files changed, 96 insertions, 0 deletions
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 000000000..6fcb41eec
--- /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 000000000..ec1913803
--- /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 000000000..57b88f566
--- /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 000000000..28293ac6c
--- /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