Browse code

Merge "Setup Keystone catalog information for Ceilometer"

Jenkins authored on 2014/01/14 02:46:26
Showing 3 changed files
... ...
@@ -51,3 +51,8 @@ catalog.RegionOne.orchestration.publicURL = http://%SERVICE_HOST%:8000/v1
51 51
 catalog.RegionOne.orchestration.adminURL = http://%SERVICE_HOST%:8000/v1
52 52
 catalog.RegionOne.orchestration.internalURL = http://%SERVICE_HOST%:8000/v1
53 53
 catalog.RegionOne.orchestration.name = Heat Service
54
+
55
+catalog.RegionOne.metering.publicURL = http://%SERVICE_HOST%:8777/v1
56
+catalog.RegionOne.metering.adminURL = http://%SERVICE_HOST%:8777/v1
57
+catalog.RegionOne.metering.internalURL = http://%SERVICE_HOST%:8777/v1
58
+catalog.RegionOne.metering.name = Telemetry Service
... ...
@@ -48,8 +48,50 @@ CEILOMETER_BIN_DIR=$(get_python_exec_prefix)
48 48
 # Set up database backend
49 49
 CEILOMETER_BACKEND=${CEILOMETER_BACKEND:-mysql}
50 50
 
51
+# Ceilometer connection info.
52
+CEILOMETER_SERVICE_PROTOCOL=http
53
+CEILOMETER_SERVICE_HOST=$SERVICE_HOST
54
+CEILOMETER_SERVICE_PORT=${CEILOMETER_SERVICE_PORT:-8777}
55
+#
56
+
51 57
 # Functions
52 58
 # ---------
59
+#
60
+# create_ceilometer_accounts() - Set up common required ceilometer accounts
61
+
62
+create_ceilometer_accounts() {
63
+
64
+    SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
65
+    ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }")
66
+
67
+    # Ceilometer
68
+    if [[ "$ENABLED_SERVICES" =~ "ceilometer-api" ]]; then
69
+        CEILOMETER_USER=$(keystone user-create \
70
+            --name=ceilometer \
71
+            --pass="$SERVICE_PASSWORD" \
72
+            --tenant_id $SERVICE_TENANT \
73
+            --email=ceilometer@example.com \
74
+            | grep " id " | get_field 2)
75
+        keystone user-role-add \
76
+            --tenant-id $SERVICE_TENANT \
77
+            --user-id $CEILOMETER_USER \
78
+            --role-id $ADMIN_ROLE
79
+        if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
80
+            CEILOMETER_SERVICE=$(keystone service-create \
81
+                --name=ceilometer \
82
+                --type=metering \
83
+                --description="OpenStack Telemetry Service" \
84
+                | grep " id " | get_field 2)
85
+            keystone endpoint-create \
86
+                --region RegionOne \
87
+                --service_id $CEILOMETER_SERVICE \
88
+                --publicurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \
89
+                --adminurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/" \
90
+                --internalurl "$CEILOMETER_SERVICE_PROTOCOL://$CEILOMETER_SERVICE_HOST:$CEILOMETER_SERVICE_PORT/"
91
+        fi
92
+    fi
93
+}
94
+
53 95
 
54 96
 # cleanup_ceilometer() - Remove residual data files, anything left over from previous
55 97
 # runs that a clean run would need to clean up
... ...
@@ -901,6 +901,10 @@ if is_service_enabled key; then
901 901
         create_trove_accounts
902 902
     fi
903 903
 
904
+    if is_service_enabled ceilometer; then
905
+        create_ceilometer_accounts
906
+    fi
907
+
904 908
     if is_service_enabled swift || is_service_enabled s-proxy; then
905 909
         create_swift_accounts
906 910
     fi