devstack config for dogpile cache

Cause devstack to configuration a [cache] section in ceilometer.conf
if CEILOMETER_CACHE_BACKEND is set. Currently set to default to
using dogpile.cache.redis and a redis server on localhost.

This options are not sufficient for generic use as the
"backend_argument"s are not controlled. For general use it is
probably best that tools just modify their local.conf to post config
ceilometer.conf.

Change-Id: I058e60f9440350f80262039171716a3ceb4dec62
This commit is contained in:
Chris Dent 2015-11-12 14:59:48 +00:00
parent a825f56827
commit 5bcd6469d3
2 changed files with 24 additions and 1 deletions

View File

@ -128,7 +128,7 @@ function _ceilometer_config_apache_wsgi {
function _ceilometer_prepare_coordination {
if echo $CEILOMETER_COORDINATION_URL | grep -q '^memcached:'; then
install_package memcached
elif echo $CEILOMETER_COORDINATION_URL | grep -q '^redis:'; then
elif [[ "${CEILOMETER_COORDINATOR_URL%%:*}" == "redis" || "${CEILOMETER_CACHE_BACKEND##*.}" == "redis" ]]; then
_ceilometer_install_redis
fi
}
@ -210,6 +210,20 @@ function cleanup_ceilometer {
fi
}
# Set configuraiton for cache backend.
# NOTE(cdent): This currently only works for redis. Still working
# out how to express the other backends.
function _ceilometer_configure_cache_backend {
iniset $CEILOMETER_CONF cache backend $CEILOMETER_CACHE_BACKEND
iniset $CEILOMETER_CONF cache backend_argument url:$CEILOMETER_CACHE_URL
iniadd_literal $CEILOMETER_CONF cache backend_argument distributed_lock:True
if [[ "${CEILOMETER_CACHE_BACKEND##*.}" == "redis" ]]; then
iniadd_literal $CEILOMETER_CONF cache backend_argument db:0
iniadd_literal $CEILOMETER_CONF cache backend_argument redis_expiration_time:600
fi
}
# Set configuration for storage backend.
function _ceilometer_configure_storage_backend {
if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] ; then
@ -248,6 +262,10 @@ function configure_ceilometer {
iniset $CEILOMETER_CONF compute workload_partitioning True
fi
if [[ -n "$CEILOMETER_CACHE_BACKEND" ]]; then
_ceilometer_configure_cache_backend
fi
# Install the policy file and declarative configuration files to
# the conf dir.
# NOTE(cdent): Do not make this a glob as it will conflict

View File

@ -34,6 +34,11 @@ CEILOMETER_EVENTS=${CEILOMETER_EVENTS:-True}
CEILOMETER_COORDINATION_URL=${CEILOMETER_COORDINATION_URL:-}
CEILOMETER_PIPELINE_INTERVAL=${CEILOMETER_PIPELINE_INTERVAL:-}
# Cache Options
# NOTE(cdent): These are incomplete and specific for this testing.
CEILOMETER_CACHE_BACKEND=${CEILOMETER_CACHE_BACKEND:-dogpile.cache.redis}
CEILOMETER_CACHE_URL=${CEILOMETER_CACHE_URL:-redis://localhost:6379}
CEILOMETER_EVENT_ALARM=${CEILOMETER_EVENT_ALARM:-False}
# Tell Tempest this project is present