From a5a469c102c091255ffacd284be123da9a98a539 Mon Sep 17 00:00:00 2001 From: Swapnil Kulkarni Date: Fri, 3 Jul 2015 05:26:39 +0000 Subject: Add config-internal/config-external for cinder Partially Implements: Blueprint standard-start Change-Id: I9fa5cc8f6f57b46f8af165778388435b91c28447 --- docker/common/cinder-app/cinder-api/start.sh | 79 +++++----------------------- 1 file changed, 14 insertions(+), 65 deletions(-) (limited to 'docker/common/cinder-app/cinder-api/start.sh') diff --git a/docker/common/cinder-app/cinder-api/start.sh b/docker/common/cinder-app/cinder-api/start.sh index cbf0159e5..4385d0631 100755 --- a/docker/common/cinder-app/cinder-api/start.sh +++ b/docker/common/cinder-app/cinder-api/start.sh @@ -1,72 +1,21 @@ #!/bin/bash -set -e +set -o errexit -. /opt/kolla/kolla-common.sh -. /opt/kolla/config-cinder.sh +CMD="/usr/bin/cinder-api" +ARGS="" -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_SERVICE_LISTEN CINDER_API_SERVICE_PORT +# Loading common functions. +source /opt/kolla/kolla-common.sh -fail_unless_os_service_running keystone +# Config-internal script exec out of this function, it does not return here. +set_configs -cfg=/etc/cinder/cinder.conf +# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases +# of the KOLLA_BOOTSTRAP variable being set, including empty. +if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then + su -s /bin/sh -c "cinder-manage db_sync" cinder + exit 0 +fi -# 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}/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" - -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 \ - "false" - -crudini --set $cfg \ - DEFAULT \ - enable_v2_api \ - "true" - -echo "Starting cinder-api" -exec /usr/bin/cinder-api --config-file $cfg +exec $CMD $ARGS -- cgit v1.2.3