From 59f90f5194dfac360cfe3a7418921c08e5359737 Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Fri, 18 Mar 2016 06:24:27 +0000 Subject: [PATCH] devstack: allow ceilometer-api and keystone to run on different hosts User now can specify CEILOMETER_SERVICE_HOST to a different host so ceilometer-api and keystone can run on different machines. Also create keystone accounts in post-config phase, by following gnocchi convention. Change-Id: Ide55f9e07d4d94e900a3596922da4c40eca8ec3c --- devstack/plugin.sh | 12 +++++++++--- devstack/settings | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index f038e5fbb1..82c8f7040e 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -163,8 +163,12 @@ function _ceilometer_prepare_virt_drivers { # Create ceilometer related accounts in Keystone -function _ceilometer_create_accounts { +function ceilometer_create_accounts { if is_service_enabled ceilometer-api; then + # At this time, the /etc/openstack/clouds.yaml is available, + # we could leverage that by setting OS_CLOUD + OLD_OS_CLOUD=$OS_CLOUD + export OS_CLOUD='devstack-admin' create_service_user "ceilometer" "admin" @@ -179,6 +183,8 @@ function _ceilometer_create_accounts { # Ceilometer needs ResellerAdmin role to access Swift account stats. get_or_add_user_project_role "ResellerAdmin" "ceilometer" $SERVICE_PROJECT_NAME fi + + export OS_CLOUD=$OLD_OS_CLOUD fi } @@ -356,8 +362,6 @@ function configure_ceilometer { # init_ceilometer() - Initialize etc. function init_ceilometer { - # Get ceilometer keystone settings in place - _ceilometer_create_accounts # Create cache dir sudo install -d -o $STACK_USER $CEILOMETER_AUTH_CACHE_DIR rm -f $CEILOMETER_AUTH_CACHE_DIR/* @@ -474,6 +478,8 @@ if is_service_enabled ceilometer; then elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then echo_summary "Configuring Ceilometer" configure_ceilometer + # Get ceilometer keystone settings in place + ceilometer_create_accounts elif [[ "$1" == "stack" && "$2" == "extra" ]]; then echo_summary "Initializing Ceilometer" # Tidy base for ceilometer diff --git a/devstack/settings b/devstack/settings index f300d5dd9d..b2c3769d90 100644 --- a/devstack/settings +++ b/devstack/settings @@ -24,7 +24,7 @@ GNOCCHI_ARCHIVE_POLICY=${GNOCCHI_ARCHIVE_POLICY:-low} # Ceilometer connection info. CEILOMETER_SERVICE_PROTOCOL=http -CEILOMETER_SERVICE_HOST=$SERVICE_HOST +CEILOMETER_SERVICE_HOST=${CEILOMETER_SERVICE_HOST:-${SERVICE_HOST}} CEILOMETER_SERVICE_PORT=${CEILOMETER_SERVICE_PORT:-8777} CEILOMETER_USE_MOD_WSGI=${CEILOMETER_USE_MOD_WSGI:-${ENABLE_HTTPD_MOD_WSGI_SERVICES}}