From 0c01e63cb0b60a6d2d0f0e616c560eed7271829a Mon Sep 17 00:00:00 2001 From: zengchen Date: Thu, 17 Dec 2015 10:47:54 +0800 Subject: [PATCH] authentication fails by keystonemiddleware In order to pass througth the authentication of keystonemiddleware, I add a function "create_smaug_accounts" to create an account in Keystone in the plugin.sh. There are 4 steps in "create_smaug_accounts" : 1. create a user "smaug". 2. bind the user with the project "service" and grant the role "service" to the user. 3. create a service "smaug". 4. create an endpoint. Change-Id: I7644e568a8912f48e54b15cf897afe67a81c2e4a Closes-Bug: #1526638 --- devstack/plugin.sh | 26 ++++++++++++++++++++++++++ devstack/settings | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 20df9ccb..a55f1e8f 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -16,6 +16,29 @@ function _create_smaug_conf_dir { } +# create_smaug_accounts() - Set up common required smaug accounts + +# Tenant User Roles +# ------------------------------------------------------------------ +# service smaug service + +function create_smaug_accounts { + + if is_service_enabled smaug-api; then + + create_service_user "smaug" + + if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then + + get_or_create_service "smaug" "protect" "Disaster Recovery Service" + get_or_create_endpoint "protect" "$REGION_NAME" \ + "$SMAUG_API_PROTOCOL://$SMAUG_API_HOST:$SMAUG_API_PORT/v1/\$(tenant_id)s" \ + "$SMAUG_API_PROTOCOL://$SMAUG_API_HOST:$SMAUG_API_PORT/v1/\$(tenant_id)s" \ + "$SMAUG_API_PROTOCOL://$SMAUG_API_HOST:$SMAUG_API_PORT/v1" + fi + fi +} + function configure_smaug_api { if is_service_enabled smaug-api ; then echo "Configuring Smaug API" @@ -75,6 +98,9 @@ if [[ "$Q_ENABLE_SMAUG" == "True" ]]; then echo export PYTHONPATH=\$PYTHONPATH:$SMAUG_DIR >> $RC_DIR/.localrc.auto elif [[ "$1" == "stack" && "$2" == "extra" ]]; then + + create_smaug_accounts + echo_summary "Initializing Smaug Service" SMAUG_BIN_DIR=$(get_python_exec_prefix) if is_service_enabled smaug-api; then diff --git a/devstack/settings b/devstack/settings index 1d20eecd..a10db76b 100644 --- a/devstack/settings +++ b/devstack/settings @@ -12,7 +12,7 @@ SMAUG_API_CONF=$SMAUG_CONF_DIR/smaug.conf SMAUG_API_LISTEN_ADDRESS=${SMAUG_API_LISTEN_ADDRESS:-0.0.0.0} SMAUG_API_HOST=${SMAUG_API_HOST:-$SERVICE_HOST} -SMAUG_API_PORT=${SMAUG_API_PORT:-19999} +SMAUG_API_PORT=${SMAUG_API_PORT:-8799} SMAUG_API_PROTOCOL=${SMAUG_API_PROTOCOL:-$SERVICE_PROTOCOL} SMAUG_AUTH_CACHE_DIR=${SMAUG_AUTH_CACHE_DIR:-/var/cache/smaug}