Add storage configuration option to devstack plugin

This adds the CLOUDKITTY_STORAGE_BACKEND option to CloudKitty's devstack
plugin, allowing users to choose the storage backend they want to use.

Change-Id: I442131cfbbb6f6229a5e8e2a9efe4a4b33338ac9
This commit is contained in:
Luka Peschke 2017-12-06 11:54:10 +01:00 committed by Maxime Cottret
parent 678fb54c08
commit 87bbf23bfa
3 changed files with 24 additions and 0 deletions

View File

@ -38,3 +38,8 @@ Configure DevStack to run CloudKitty
Run devstack as usual::
$ ./stack.sh
See the documentation_ if you want more details about how to configure the
devstack plugin.
.. _documentation: https://docs.openstack.org/cloudkitty/latest/devstack.html

View File

@ -173,6 +173,12 @@ function configure_cloudkitty {
iniset $CLOUDKITTY_CONF output basepath $CLOUDKITTY_OUTPUT_BASEPATH
iniset $CLOUDKITTY_CONF output pipeline $CLOUDKITTY_OUTPUT_PIPELINE
# storage
iniset $CLOUDKITTY_CONF storage backend $CLOUDKITTY_STORAGE_BACKEND
if [ "$CLOUDKITTY_STORAGE_BACKEND" != "sqlalchemy" ]; then
iniset $CLOUDKITTY_CONF storage_${CLOUDKITTY_STORAGE_BACKEND} auth_section authinfos
fi
# database
local dburl=`database_connection_url cloudkitty`
iniset $CLOUDKITTY_CONF database connection $dburl
@ -185,6 +191,13 @@ function configure_cloudkitty {
fi
}
function wait_for_gnocchi() {
local gnocchi_url=$(openstack --os-cloud devstack-admin endpoint list --service metric --interface public -c URL -f value)
if ! wait_for_service $SERVICE_TIMEOUT $gnocchi_url; then
die $LINENO "Waited for gnocchi too long."
fi
}
# create_cloudkitty_cache_dir() - Part of the init_cloudkitty() process
function create_cloudkitty_cache_dir {
# Create cache dir
@ -226,6 +239,9 @@ function init_cloudkitty {
$CLOUDKITTY_BIN_DIR/cloudkitty-dbsync upgrade
# Init the storage backend
if [ $CLOUDKITTY_STORAGE_BACKEND == 'hybrid' ]; then
wait_for_gnocchi
fi
$CLOUDKITTY_BIN_DIR/cloudkitty-storage-init
create_cloudkitty_cache_dir

View File

@ -45,6 +45,9 @@ CLOUDKITTY_COLLECTOR=${CLOUDKITTY_COLLECTOR:-gnocchi}
CLOUDKITTY_SERVICES=${CLOUDKITTY_SERVICES:-compute}
CLOUDKITTY_METRICS_CONF=metrics.yml
# Set CloudKitty storage info
CLOUDKITTY_STORAGE_BACKEND=${CLOUDKITTY_STORAGE_BACKEND:-"sqlalchemy"}
# Set CloudKitty output info
CLOUDKITTY_OUTPUT_BACKEND=${CLOUDKITTY_OUTPUT_BACKEND:-"cloudkitty.backend.file.FileBackend"}
CLOUDKITTY_OUTPUT_BASEPATH=${CLOUDKITTY_OUTPUT_BASEPATH:-$CLOUDKITTY_REPORTS_DIR}