From fa5ccfff1098bb85eb7810ad5146fbdfee83fb15 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 9 Jan 2014 13:27:35 +0100 Subject: [PATCH] Setup Keystone catalog information for Ceilometer Change-Id: I3f536f38fe7862ee41b06d1d48b848cc07492c8d Closes-Bug: #1267322 --- files/default_catalog.templates | 5 ++++ lib/ceilometer | 42 +++++++++++++++++++++++++++++++++ stack.sh | 4 ++++ 3 files changed, 51 insertions(+) diff --git a/files/default_catalog.templates b/files/default_catalog.templates index 277904a8e3..430c42a337 100644 --- a/files/default_catalog.templates +++ b/files/default_catalog.templates @@ -51,3 +51,8 @@ catalog.RegionOne.orchestration.publicURL = http://%SERVICE_HOST%:8000/v1 catalog.RegionOne.orchestration.adminURL = http://%SERVICE_HOST%:8000/v1 catalog.RegionOne.orchestration.internalURL = http://%SERVICE_HOST%:8000/v1 catalog.RegionOne.orchestration.name = Heat Service + +catalog.RegionOne.metering.publicURL = http://%SERVICE_HOST%:8777/v1 +catalog.RegionOne.metering.adminURL = http://%SERVICE_HOST%:8777/v1 +catalog.RegionOne.metering.internalURL = http://%SERVICE_HOST%:8777/v1 +catalog.RegionOne.metering.name = Telemetry Service diff --git a/lib/ceilometer b/lib/ceilometer index fac3be14a9..fe72fcdb11 100644 --- a/lib/ceilometer +++ b/lib/ceilometer @@ -48,8 +48,50 @@ CEILOMETER_BIN_DIR=$(get_python_exec_prefix) # Set up database backend CEILOMETER_BACKEND=${CEILOMETER_BACKEND:-mysql} +# Ceilometer connection info. +CEILOMETER_SERVICE_PROTOCOL=http +CEILOMETER_SERVICE_HOST=$SERVICE_HOST +CEILOMETER_SERVICE_PORT=${CEILOMETER_SERVICE_PORT:-8777} +# + # Functions # --------- +# +# create_ceilometer_accounts() - Set up common required ceilometer accounts + +create_ceilometer_accounts() { + + SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }") + ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }") + + # Ceilometer + if [[ "$ENABLED_SERVICES" =~ "ceilometer-api" ]]; then + CEILOMETER_USER=$(keystone user-create \ + --name=ceilometer \ + --pass="$SERVICE_PASSWORD" \ + --tenant_id $SERVICE_TENANT \ + --email=ceilometer@example.com \ + | grep " id " | get_field 2) + keystone user-role-add \ + --tenant-id $SERVICE_TENANT \ + --user-id $CEILOMETER_USER \ + --role-id $ADMIN_ROLE + if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then + CEILOMETER_SERVICE=$(keystone service-create \ + --name=ceilometer \ + --type=metering \ + --description="OpenStack Telemetry Service" \ + | grep " id " | get_field 2) + keystone endpoint-create \ + --region RegionOne \ + --service_id $CEILOMETER_SERVICE \ + --publicurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \ + --adminurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \ + --internalurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" + fi + fi +} + # cleanup_ceilometer() - Remove residual data files, anything left over from previous # runs that a clean run would need to clean up diff --git a/stack.sh b/stack.sh index 2438f9fffc..bf782bc047 100755 --- a/stack.sh +++ b/stack.sh @@ -901,6 +901,10 @@ if is_service_enabled key; then create_trove_accounts fi + if is_service_enabled ceilometer; then + create_ceilometer_accounts + fi + if is_service_enabled swift || is_service_enabled s-proxy; then create_swift_accounts fi