Browse code

Swift: configure Ceilometer when it is enabled

This allows the storage.objects.{incoming,outgoing}.bytes measurements to be
easily used.

Closes-Bug: #1221097
Change-Id: If988a85930d7df1e043997763c3b5ebd720d6d86

Cyril Roelandt authored on 2013/09/05 18:20:15
Showing 1 changed files
... ...
@@ -61,6 +61,10 @@ SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-1000000}
61 61
 # Default is ``staticweb, tempurl, formpost``
62 62
 SWIFT_EXTRAS_MIDDLEWARE=${SWIFT_EXTRAS_MIDDLEWARE:-tempurl formpost staticweb}
63 63
 
64
+# Set ``SWIFT_EXTRAS_MIDDLEWARE_LAST`` to extras middlewares that need to be at
65
+# the end of the pipeline.
66
+SWIFT_EXTRAS_MIDDLEWARE_LAST=${SWIFT_EXTRAS_MIDDLEWARE_LAST}
67
+
64 68
 # The ring uses a configurable number of bits from a path’s MD5 hash as
65 69
 # a partition index that designates a device. The number of bits kept
66 70
 # from the hash is known as the partition power, and 2 to the partition
... ...
@@ -252,6 +256,12 @@ function configure_swift() {
252 252
     iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port
253 253
     iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port ${SWIFT_DEFAULT_BIND_PORT:-8080}
254 254
 
255
+    # Configure Ceilometer
256
+    if is_service_enabled ceilometer; then
257
+        iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:ceilometer use "egg:ceilometer#swift"
258
+        SWIFT_EXTRAS_MIDDLEWARE_LAST="${SWIFT_EXTRAS_MIDDLEWARE_LAST} ceilometer"
259
+    fi
260
+
255 261
     # By default Swift will be installed with keystone and tempauth middleware
256 262
     # and add the swift3 middleware if its configured for it. The token for
257 263
     # tempauth would be prefixed with the reseller_prefix setting TEMPAUTH_ the
... ...
@@ -261,6 +271,7 @@ function configure_swift() {
261 261
     fi
262 262
     swift_pipeline+=" authtoken keystoneauth tempauth "
263 263
     sed -i "/^pipeline/ { s/tempauth/${swift_pipeline} ${SWIFT_EXTRAS_MIDDLEWARE}/ ;}" ${SWIFT_CONFIG_PROXY_SERVER}
264
+    sed -i "/^pipeline/ { s/proxy-server/${SWIFT_EXTRAS_MIDDLEWARE_LAST} proxy-server/ ; }" ${SWIFT_CONFIG_PROXY_SERVER}
264 265
 
265 266
     iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} filter:tempauth account_autocreate
266 267
     iniset ${SWIFT_CONFIG_PROXY_SERVER} app:proxy-server account_autocreate true