diff --git a/devstack/README.rst b/devstack/README.rst index 20b733e0..c2ccdb6b 100644 --- a/devstack/README.rst +++ b/devstack/README.rst @@ -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 diff --git a/devstack/plugin.sh b/devstack/plugin.sh index a6f10bad..7465da9a 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -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 diff --git a/devstack/settings b/devstack/settings index dd6ff391..c539b9f7 100644 --- a/devstack/settings +++ b/devstack/settings @@ -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}