From 8abd8598b3ba7dce126db7553dfc704e5a343966 Mon Sep 17 00:00:00 2001
From: Chris Dent <chdent@redhat.com>
Date: Wed, 8 Oct 2014 15:24:25 +0100
Subject: [PATCH] Allow use of ceilometer agent coordination

Juno brings tooz-based coordination of ceilometer central, compute
and alarm agents. If CEILOMETER_COORDINATION_URL is set it will be
used as the value for a tooz coordination backend. If memcached is
chosen, its package will be installed. Other backends, such as
zookeeper can be configured, but installation is left as an exercise
for the devstacker.

In the default devstack setup having coordination will do little as
there are only one of each agent, but this makes it a bit easier for
multi-node or multi-agent setups.

Change-Id: Ib85ccd435de3bc0ae56b5fe8c2fce6c2af9ff8d0
---
 lib/ceilometer | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/ceilometer b/lib/ceilometer
index db0c457262..9046b9d3d9 100644
--- a/lib/ceilometer
+++ b/lib/ceilometer
@@ -155,6 +155,11 @@ function configure_ceilometer {
     iniset $CEILOMETER_CONF DEFAULT verbose True
     iniset $CEILOMETER_CONF DEFAULT debug "$ENABLE_DEBUG_LOG_LEVEL"
 
+    if [[ -n "$CEILOMETER_COORDINATION_URL" ]]; then
+        iniset $CEILOMETER_CONF coordination backend_url $CEILOMETER_COORDINATION_URL
+        iniset $CEILOMETER_CONF compute workload_partitioning True
+    fi
+
     # Install the policy file for the API server
     cp $CEILOMETER_DIR/etc/ceilometer/policy.json $CEILOMETER_CONF_DIR
     iniset $CEILOMETER_CONF DEFAULT policy_file $CEILOMETER_CONF_DIR/policy.json
@@ -242,6 +247,9 @@ function install_ceilometer {
     git_clone $CEILOMETER_REPO $CEILOMETER_DIR $CEILOMETER_BRANCH
     setup_develop $CEILOMETER_DIR
 
+    if echo $CEILOMETER_COORDINATION_URL | grep -q '^memcached:'; then
+        install_package memcached
+    fi
 }
 
 # install_ceilometerclient() - Collect source and prepare