Fix check-sanity + save-state /w disabled services

This adds a mapping for all process names described in BASE_SERVICES
and TARGET_SERVICES, allowing check-sanity to skip checking for running
processes of services that are disabled according to ENABLED_SERVICES.
It also updates grenade.sh and save-state to only dump databases that
exist.  These changes allow grenade to pass against deployments that
have disabled non-essential services in devstack.

Change-Id: Ic4b2bab88b12f33f939b9bf7aca47e930d799f3f
Closes-bug: #1355499
This commit is contained in:
Adam Gandelman 2014-08-11 16:38:55 -07:00
parent 4909db4800
commit 376e301d48
3 changed files with 33 additions and 6 deletions

View File

@ -26,6 +26,8 @@ source $GRENADE_DIR/grenaderc
# We need the OS_ credentials # We need the OS_ credentials
source $TARGET_DEVSTACK_DIR/openrc source $TARGET_DEVSTACK_DIR/openrc
source $TARGET_DEVSTACK_DIR/functions source $TARGET_DEVSTACK_DIR/functions
source $TARGET_DEVSTACK_DIR/localrc
function is_a_service { function is_a_service {
local name=$1 local name=$1
@ -79,13 +81,34 @@ function test_all_enabled_services {
fi fi
} }
# For a given process name, resolve the corresponding devstack service
# name as it would appear in ENABLED_SERVICES.
function process_to_service {
case "$1" in
"nova-api") echo "n-api" ;;
"nova-conductor") echo "n-cond" ;;
"nova-compute") echo "n-cpu" ;;
"keystone") echo "key" ;;
"glance-api") echo "g-api" ;;
"cinder-api") echo "c-api" ;;
"swift-object-server") echo "s-obj" ;;
"swift-proxy-server") echo "s-proxy" ;;
*) echo "$1" ;;
esac
}
test_all_enabled_services test_all_enabled_services
# all the services should actually be running that we expect # all the services should actually be running that we expect
NOT_RUNNING="" NOT_RUNNING=""
for name in ${TARGET_SERVICES}; do RUNNING=""
if ! is_running ${name}; then for proc_name in ${TARGET_SERVICES}; do
NOT_RUNNING="$NOT_RUNNING $name" if is_service_enabled "$(process_to_service $proc_name)" ; then
if ! is_running ${proc_name}; then
NOT_RUNNING="$NOT_RUNNING $proc_name"
else
RUNNING="$RUNNING $proc_name"
fi
fi fi
done done
@ -94,7 +117,7 @@ if [[ -n "$NOT_RUNNING" ]]; then
$GRENADE_DIR/tools/worlddump.py -d $LOGDIR $GRENADE_DIR/tools/worlddump.py -d $LOGDIR
exit 1 exit 1
else else
echo "the following services are running: $TARGET_SERVICES" echo "the following services are running: $RUNNING"
fi fi
echo "*********************************************************************" echo "*********************************************************************"

View File

@ -380,7 +380,9 @@ if [[ "$RUN_TARGET" == "True" ]]; then
mongodump --db ceilometer --out $SAVE_DIR/ceilometer-dump.$TARGET_RELEASE mongodump --db ceilometer --out $SAVE_DIR/ceilometer-dump.$TARGET_RELEASE
fi fi
for db in $MYSQL_SERVICES ; do for db in $MYSQL_SERVICES ; do
mysqldump -uroot -p$MYSQL_PASSWORD $db >$SAVE_DIR/$db.sql.$TARGET_RELEASE if mysql -uroot -p$MYSQL_PASSWORD -c $db -e ''; then
mysqldump -uroot -p$MYSQL_PASSWORD $db >$SAVE_DIR/$db.sql.$TARGET_RELEASE
fi
done done
neutron_db_names=$(mysql -uroot -p$MYSQL_PASSWORD -e "show databases;" | grep neutron || :) neutron_db_names=$(mysql -uroot -p$MYSQL_PASSWORD -e "show databases;" | grep neutron || :)
for neutron_db in $neutron_db_names; do for neutron_db in $neutron_db_names; do

View File

@ -48,7 +48,9 @@ elif grep -q 'connection *= *mongo' /etc/ceilometer/ceilometer.conf; then
mongodump --db ceilometer --out $SAVE_DIR/ceilometer-dump.$BASE_RELEASE mongodump --db ceilometer --out $SAVE_DIR/ceilometer-dump.$BASE_RELEASE
fi fi
for db in $MYSQL_SERVICES ; do for db in $MYSQL_SERVICES ; do
mysqldump -uroot -p$MYSQL_PASSWORD $db >$SAVE_DIR/$db.sql.$BASE_RELEASE if mysql -uroot -p$MYSQL_PASSWORD -c $db -e ''; then
mysqldump -uroot -p$MYSQL_PASSWORD $db >$SAVE_DIR/$db.sql.$BASE_RELEASE
fi
done done
neutron_db_names=$(mysql -uroot -p$MYSQL_PASSWORD -e "show databases;" | grep neutron || :) neutron_db_names=$(mysql -uroot -p$MYSQL_PASSWORD -e "show databases;" | grep neutron || :)
for neutron_db in $neutron_db_names; do for neutron_db in $neutron_db_names; do