
This adds nova modular service checks, including the use of the verify_noapi phase to ensure the server doesn't go away when nova-compute is down (which is a substantial enhancement of our existing validation). There is slight regression in checking multiple servers, however that did not seem to be a bug that we actually ran into. add our own local copy of ping_check to grenade. The version in devstack gets diverted down a neutron path even though we actually want to use it in a public context. We need to change that code to work on public networks regardless of backend. Until then, we'll keep our own copy. Change-Id: I985ca38ef670b03802f9ad67ce19cf94cfc802ae
89 lines
2.5 KiB
Plaintext
89 lines
2.5 KiB
Plaintext
# functions - Grenade-specific functions
|
|
#
|
|
# The following variables are assumed to be defined by certain functions:
|
|
#
|
|
# - ``MYSQL_PASSWORD``
|
|
# - ``SAVE_DIR``
|
|
|
|
|
|
# Include the common functions
|
|
GRENADE_DIR=$(cd $(dirname "${BASH_SOURCE:-$0}") && pwd)
|
|
source ${TARGET_DEVSTACK_DIR}/functions
|
|
source ${GRENADE_DIR}/inc/upgrade
|
|
source ${GRENADE_DIR}/inc/plugin
|
|
|
|
# Save trace setting
|
|
XTRACE=$(set +o | grep xtrace)
|
|
set +o xtrace
|
|
|
|
# TODO: we'd really like to use the ping_check_functions that exist in
|
|
# devstack, however they are all wrapped up in lib/neutron-legacy
|
|
# gorp. Until that can be cleanly separated we need to keep our own
|
|
# copy here.
|
|
#
|
|
# ping_check_public $ip $timeout [False] - ping an machine on a public
|
|
# ip address. Should work with either neutron or nova-net. Also works
|
|
# to ensure the guest is not up if you pass False as last parameter.
|
|
function ping_check_public {
|
|
local ip=$1
|
|
local boot_timeout=$2
|
|
local expected=${3:-"True"}
|
|
local check_command=""
|
|
if [[ "$expected" = "True" ]]; then
|
|
check_command="while ! ping -c1 -w1 $ip; do sleep 1; done"
|
|
else
|
|
check_command="while ping -c1 -w1 $ip; do sleep 1; done"
|
|
fi
|
|
if ! timeout $boot_timeout sh -c "$check_command"; then
|
|
if [[ "$expected" = "True" ]]; then
|
|
die $LINENO "[Fail] Couldn't ping server"
|
|
else
|
|
die $LINENO "[Fail] Could ping server"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# save_data() dumps service datastores into SAVE_DIR for base or
|
|
# target release.
|
|
function save_data {
|
|
local release=$1
|
|
local dir=$2
|
|
echo_summary "Dumping $release databases"
|
|
mkdir -p $SAVE_DIR
|
|
save_mysql_dbs $release $dir
|
|
|
|
# TODO(sdague): this should go into per project save-state scripts
|
|
if grep -q 'connection *= *mongo' /etc/ceilometer/ceilometer.conf; then
|
|
mongodump --db ceilometer --out $SAVE_DIR/ceilometer-dump.$release
|
|
fi
|
|
}
|
|
|
|
|
|
# Setup Exit Traps for debug purposes
|
|
trap exit_trap EXIT
|
|
function exit_trap {
|
|
# really important that this is the *first* line in this
|
|
# function, otherwise we corrupt the exit code
|
|
local r=$?
|
|
# we don't need tracing during this
|
|
set +o xtrace
|
|
if [[ $r -ne 0 ]]; then
|
|
# unwind the call stack on failures
|
|
local frame=0
|
|
while caller $frame; do
|
|
((frame++));
|
|
done
|
|
|
|
echo "Exit code: $r"
|
|
if [[ -x $TARGET_DEVSTACK_DIR/tools/worlddump.py ]]; then
|
|
$TARGET_DEVSTACK_DIR/tools/worlddump.py -d $LOGDIR
|
|
sleep 1
|
|
fi
|
|
fi
|
|
exit $r
|
|
}
|
|
|
|
|
|
# Restore xtrace
|
|
$XTRACE
|