Grenade plugin using devstack plugin for ceilometer

This is barebones for now, simply doing the upgrade and checking
services are still running. There is no checking of resources.
Being able to easily add those resources checks is part of the
reason for making this change.

The other reason is to explore and resolve conflicts when extracting
an existing integrated project from both devstack and grenade.

Note that grenade's ensure_services_started and _stopped struggles to
work with processes that contain spaces so distinguishing amongst
ceilometer-polling processes with different namespaces is hard, so
we'll just use the older agent names.

Change-Id: If7bb809743ab0c475a1844c79e552d8b6892a18f
This commit is contained in:
Chris Dent 2015-06-28 14:56:25 +00:00
parent de71be0bf5
commit c71c5ddf43
4 changed files with 120 additions and 4 deletions

View File

@ -340,9 +340,9 @@ function install_ceilometerclient {
# start_ceilometer() - Start running processes, including screen
function start_ceilometer {
run_process ceilometer-acentral "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces central --config-file $CEILOMETER_CONF"
run_process ceilometer-acentral "$CEILOMETER_BIN_DIR/ceilometer-agent-central --config-file $CEILOMETER_CONF"
run_process ceilometer-anotification "$CEILOMETER_BIN_DIR/ceilometer-agent-notification --config-file $CEILOMETER_CONF"
run_process ceilometer-aipmi "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces ipmi --config-file $CEILOMETER_CONF"
run_process ceilometer-aipmi "$CEILOMETER_BIN_DIR/ceilometer-agent-ipmi --config-file $CEILOMETER_CONF"
if [[ "$CEILOMETER_USE_MOD_WSGI" == "False" ]]; then
run_process ceilometer-api "$CEILOMETER_BIN_DIR/ceilometer-api -d -v --log-dir=$CEILOMETER_API_LOG_DIR --config-file $CEILOMETER_CONF"
@ -360,10 +360,10 @@ function start_ceilometer {
# Start the compute agent late to allow time for the collector to
# fully wake up and connect to the message bus. See bug #1355809
if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then
run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespaces compute --config-file $CEILOMETER_CONF" $LIBVIRT_GROUP
run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF" $LIBVIRT_GROUP
fi
if [[ "$VIRT_DRIVER" = 'vsphere' ]]; then
run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-polling --polling-namespace compute --config-file $CEILOMETER_CONF"
run_process ceilometer-acompute "$CEILOMETER_BIN_DIR/ceilometer-agent-compute --config-file $CEILOMETER_CONF"
fi
# Only die on API if it was actually intended to be turned on

View File

@ -0,0 +1,7 @@
register_project_for_upgrade ceilometer
devstack_localrc base enable_plugin ceilometer git://git.openstack.org/openstack/ceilometer
devstack_localrc base enable_service ceilometer-acompute ceilometer-acentral ceilometer-aipmi ceilometer-anotification ceilometer-collector ceilometer-api ceilometer-alarm-notifier ceilometer-alarm-evaluator tempest
devstack_localrc target enable_plugin ceilometer git://git.openstack.org/openstack/ceilometer
devstack_localrc target enable_service ceilometer-acompute ceilometer-acentral ceilometer-aipmi ceilometer-anotification ceilometer-collector ceilometer-api ceilometer-alarm-notifier ceilometer-alarm-evaluator tempest

21
devstack/upgrade/shutdown.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
#
#
set -o errexit
source $GRENADE_DIR/grenaderc
source $GRENADE_DIR/functions
# We need base DevStack functions for this.
# TODO(chdent): This relies on the fact that for now base devstack is
# hosting ceilometer itself. Once M* starts this will need to be smarter.
source $BASE_DEVSTACK_DIR/functions
source $BASE_DEVSTACK_DIR/stackrc # needed for status directory
source $BASE_DEVSTACK_DIR/lib/tls
source $BASE_DEVSTACK_DIR/lib/apache
source $BASE_DEVSTACK_DIR/lib/ceilometer
set -o xtrace
stop_ceilometer

88
devstack/upgrade/upgrade.sh Executable file
View File

@ -0,0 +1,88 @@
#!/usr/bin/env bash
# ``upgrade-ceilometer``
echo "*********************************************************************"
echo "Begin $0"
echo "*********************************************************************"
# Clean up any resources that may be in use
cleanup() {
set +o errexit
echo "*********************************************************************"
echo "ERROR: Abort $0"
echo "*********************************************************************"
# Kill ourselves to signal any calling process
trap 2; kill -2 $$
}
trap cleanup SIGHUP SIGINT SIGTERM
# Keep track of the grenade directory
RUN_DIR=$(cd $(dirname "$0") && pwd)
# Source params
source $GRENADE_DIR/grenaderc
# Import common functions
source $GRENADE_DIR/functions
# This script exits on an error so that errors don't compound and you see
# only the first error that occurred.
set -o errexit
# Save mongodb state (replace with snapshot)
# TODO(chdent): There used to be a 'register_db_to_save ceilometer'
# which may wish to consider putting back in.
if grep -q 'connection *= *mongo' /etc/ceilometer/ceilometer.conf; then
mongodump --db ceilometer --out $SAVE_DIR/ceilometer-dump.$BASE_RELEASE
fi
# Upgrade Ceilometer
# ==================
# Locate ceilometer devstack plugin, the directory above the
# grenade plugin.
CEILOMETER_DEVSTACK_DIR=$(dirname $(dirname $0))
# Get functions from current DevStack
source $TARGET_DEVSTACK_DIR/functions
source $TARGET_DEVSTACK_DIR/stackrc
source $TARGET_DEVSTACK_DIR/lib/apache
# Get ceilometer functions from devstack plugin
source $CEILOMETER_DEVSTACK_DIR/settings
# Print the commands being run so that we can see the command that triggers
# an error.
set -o xtrace
# Install the target ceilometer
source $CEILOMETER_DEVSTACK_DIR/plugin.sh stack install
# calls upgrade-ceilometer for specific release
upgrade_project ceilometer $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH
# Migrate the database
# NOTE(chdent): As we evolve BIN_DIR is likely to be defined, but
# currently it is not.
CEILOMETER_BIN_DIR=$(dirname $(which ceilometer-dbsync))
$CEILOMETER_BIN_DIR/ceilometer-dbsync || die $LINENO "DB sync error"
# Start Ceilometer
start_ceilometer
# Note these are process names, not service names
ensure_services_started ceilometer-agent-ipmi ceilometer-agent-compute ceilometer-agent-central ceilometer-agent-notification ceilometer-alarm-evaluator ceilometer-alarm-notifier ceilometer-api ceilometer-collector
# Save mongodb state (replace with snapshot)
if grep -q 'connection *= *mongo' /etc/ceilometer/ceilometer.conf; then
mongodump --db ceilometer --out $SAVE_DIR/ceilometer-dump.$TARGET_RELEASE
fi
set +o xtrace
echo "*********************************************************************"
echo "SUCCESS: End $0"
echo "*********************************************************************"