Config for ceilometer gathering from glance

Some changes are required so that ceilometer can gather usage data
from glance (notification & polling) out-of-the-box in devstack:

 - configure glance to emit notifications if rabbitmq or qpid
   is enabled

 - configure the ceilometer collector to consume notifications
   on the default glance topic (glance_notifications.*)

 - pass credentials to ceilometer central agent so that it
   authtenticate polling calls to glance

Change-Id: I0eac223eddb615266e28447b18fcaaadcd40dddf
diff --git a/lib/glance b/lib/glance
index 4cc6253..070c80d 100644
--- a/lib/glance
+++ b/lib/glance
@@ -107,6 +107,13 @@
     iniset $GLANCE_API_CONF keystone_authtoken admin_tenant_name $SERVICE_TENANT_NAME
     iniset $GLANCE_API_CONF keystone_authtoken admin_user glance
     iniset $GLANCE_API_CONF keystone_authtoken admin_password $SERVICE_PASSWORD
+    if is_service_enabled qpid; then
+        iniset $GLANCE_API_CONF DEFAULT notifier_strategy qpid
+    elif [ -n "$RABBIT_HOST" ] &&  [ -n "$RABBIT_PASSWORD" ]; then
+        iniset $GLANCE_API_CONF DEFAULT notifier_strategy rabbit
+        iniset $GLANCE_API_CONF DEFAULT rabbit_host $RABBIT_HOST
+        iniset $GLANCE_API_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
+    fi
 
     cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI