Remove stop nova processes from upgrade-nova

stop-base already stop services, so don't need to do it again in
upgrade-nova. This is needed So we can keep the old nova-compute up for
rolling upgrade testing. Instead of killing the entire screen process
kill all the services inside of it.

stop-base is the preferred place to manage the stop logic, because it
has access to the base devstack's stop-* commands.

Change-Id: Ifa2b6305f1f6bbe41407ca12a0f3cbc99b09f301
This commit is contained in:
Joe Gordon 2013-12-24 12:44:09 -08:00
parent a6c7d4b4db
commit da7fb5d7c5
4 changed files with 30 additions and 14 deletions

View File

@ -1104,6 +1104,29 @@ function screen_it {
fi
}
# Stop a service in screen
# If a PID is available use it, kill the whole process group via TERM
# If screen is being used kill the screen window; this will catch processes
# that did not leave a PID behind
# screen_stop service
function screen_stop() {
SCREEN_NAME=${SCREEN_NAME:-stack}
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
USE_SCREEN=$(trueorfalse True $USE_SCREEN)
if is_service_enabled $1; then
# Kill via pid if we have one available
if [[ -r $SERVICE_DIR/$SCREEN_NAME/$1.pid ]]; then
pkill -TERM -P -$(cat $SERVICE_DIR/$SCREEN_NAME/$1.pid)
rm $SERVICE_DIR/$SCREEN_NAME/$1.pid
fi
if [[ "$USE_SCREEN" = "True" ]]; then
# Clean up the screen window
screen -S $SCREEN_NAME -p $1 -X kill
fi
fi
}
# Screen rc file builder
# screen_rc service "command-line"

View File

@ -71,9 +71,6 @@ fi
# Get target config
source $TARGET_DEVSTACK_DIR/stackrc
# Create a new named screen to run processes in
screen -d -m -S $SCREEN_NAME -t shell -s /bin/bash
sleep 1
# Set a reasonable statusbar
SCREEN_HARDSTATUS=${SCREEN_HARDSTATUS:-'%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'}
screen -r $SCREEN_NAME -X hardstatus alwayslastline "$SCREEN_HARDSTATUS"

View File

@ -33,14 +33,15 @@ set -o xtrace
echo "Shutting down devstack in screen"
# Shut down running processes in screen - most of them
# Kill running processes
SCREEN=$(which screen)
if [[ -n "$SCREEN" ]]; then
SESSION=$(screen -ls | awk "/[0-9].${SCREEN_NAME}/ { print \$1 }")
if [[ -n "$SESSION" ]]; then
screen -X -S $SESSION quit
sleep 2
fi
OIFS=$IFS
IFS=,
for serv in $ENABLED_SERVICES; do
screen_stop $serv
done
IFS=$OIFS
fi
# Swift runs daemons

View File

@ -49,11 +49,6 @@ TOP_DIR=$TARGET_DEVSTACK_DIR
# Upgrade Nova
# ============
# Kill running Nova processes
for serv in n-api n-cond n-cauth n-cpu n-crt n-net n-novnc n-obj n-sch n-vol n-xvnc; do
screen -S $SCREEN_NAME -p $serv -X kill
done
MYSQL_HOST=${MYSQL_HOST:-localhost}
MYSQL_USER=${MYSQL_USER:-root}
BASE_SQL_CONN=$(source $BASE_DEVSTACK_DIR/stackrc; echo ${BASE_SQL_CONN:-mysql://$MYSQL_USER:$MYSQL_PASSWORD@$MYSQL_HOST})