Add option to make screen starting more robust.
We have seen a number of failures in ci where a host is overloaded and the 1.5 second sleep before stuffing data into screen is not long enough. This means the service doesn't start and tests fail. This change adds a config option to allow us to turn off the developer friendly option to stuff text into the screen. When SCREEN_DEV is set to False it will use a simple exec in screen instead of stuff. This should be far more reliable because we don't have to wait for bash to start. Change-Id: I7f1b5dbf5329b23507cb767d54a2795be0d73e01
This commit is contained in:
parent
098b272cf7
commit
58e2134964
@ -738,15 +738,16 @@ function restart_service() {
|
|||||||
# Helper to launch a service in a named screen
|
# Helper to launch a service in a named screen
|
||||||
# screen_it service "command-line"
|
# screen_it service "command-line"
|
||||||
function screen_it {
|
function screen_it {
|
||||||
NL=`echo -ne '\015'`
|
|
||||||
SCREEN_NAME=${SCREEN_NAME:-stack}
|
SCREEN_NAME=${SCREEN_NAME:-stack}
|
||||||
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
|
SERVICE_DIR=${SERVICE_DIR:-${DEST}/status}
|
||||||
|
SCREEN_DEV=`trueorfalse True $SCREEN_DEV`
|
||||||
|
|
||||||
if is_service_enabled $1; then
|
if is_service_enabled $1; then
|
||||||
# Append the service to the screen rc file
|
# Append the service to the screen rc file
|
||||||
screen_rc "$1" "$2"
|
screen_rc "$1" "$2"
|
||||||
|
|
||||||
screen -S $SCREEN_NAME -X screen -t $1
|
screen -S $SCREEN_NAME -X screen -t $1
|
||||||
|
if [[ "$SCREEN_DEV" = "True" ]]; then
|
||||||
# sleep to allow bash to be ready to be send the command - we are
|
# sleep to allow bash to be ready to be send the command - we are
|
||||||
# creating a new window in screen and then sends characters, so if
|
# creating a new window in screen and then sends characters, so if
|
||||||
# bash isn't running by the time we send the command, nothing happens
|
# bash isn't running by the time we send the command, nothing happens
|
||||||
@ -757,7 +758,11 @@ function screen_it {
|
|||||||
screen -S $SCREEN_NAME -p $1 -X log on
|
screen -S $SCREEN_NAME -p $1 -X log on
|
||||||
ln -sf ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${1}.log
|
ln -sf ${SCREEN_LOGDIR}/screen-${1}.${CURRENT_LOG_TIME}.log ${SCREEN_LOGDIR}/screen-${1}.log
|
||||||
fi
|
fi
|
||||||
|
NL=`echo -ne '\015'`
|
||||||
screen -S $SCREEN_NAME -p $1 -X stuff "$2 || touch \"$SERVICE_DIR/$SCREEN_NAME/$1.failure\"$NL"
|
screen -S $SCREEN_NAME -p $1 -X stuff "$2 || touch \"$SERVICE_DIR/$SCREEN_NAME/$1.failure\"$NL"
|
||||||
|
else
|
||||||
|
screen -S $SCREEN_NAME -p $1 -X exec /bin/bash -c "$2 || touch \"$SERVICE_DIR/$SCREEN_NAME/$1.failure\""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
stackrc
7
stackrc
@ -29,6 +29,13 @@ ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-cond,cinder,c-s
|
|||||||
# Set the default Nova APIs to enable
|
# Set the default Nova APIs to enable
|
||||||
NOVA_ENABLED_APIS=ec2,osapi_compute,metadata
|
NOVA_ENABLED_APIS=ec2,osapi_compute,metadata
|
||||||
|
|
||||||
|
# Whether to use 'dev mode' for screen windows. Dev mode works by
|
||||||
|
# stuffing text into the screen windows so that a developer can use
|
||||||
|
# ctrl-c, up-arrow, enter to restart the service. Starting services
|
||||||
|
# this way is slightly unreliable, and a bit slower, so this can
|
||||||
|
# be disabled for automated testing by setting this value to false.
|
||||||
|
SCREEN_DEV=True
|
||||||
|
|
||||||
# Repositories
|
# Repositories
|
||||||
# ------------
|
# ------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user