Create exerciserc to configure exercises

* Move timeouts from openrc to (new) exerciserc
* Update all exercise scripts
* Update HACKING.rst

Fixes bug 951315

Change-Id: Icc4ff03a7dcf0cc711e204046176fb5186990c17
This commit is contained in:
Dean Troyer 2012-03-09 22:21:59 -06:00
parent 8da5656ffd
commit 51fb454f71
9 changed files with 62 additions and 59 deletions

View File

@ -43,15 +43,14 @@ Many scripts will utilize shared functions from the ``functions`` file. There a
also rc files (``stackrc`` and ``openrc``) that are often included to set the primary also rc files (``stackrc`` and ``openrc``) that are often included to set the primary
configuration of the user environment:: configuration of the user environment::
# Use openrc + stackrc + localrc for settings # Keep track of the current devstack directory.
pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null TOP_DIR=$(cd $(dirname "$0") && pwd)
# Import common functions # Import common functions
source ./functions source $TOP_DIR/functions
# Import configuration # Import configuration
source ./openrc source $TOP_DIR/openrc
popd >/dev/null
``stack.sh`` is a rather large monolithic script that flows through from beginning ``stack.sh`` is a rather large monolithic script that flows through from beginning
to end. There is a proposal to segment it to put the OpenStack projects to end. There is a proposal to segment it to put the OpenStack projects
@ -119,6 +118,12 @@ These scripts are executed serially by ``exercise.sh`` in testing situations.
# an error. It is also useful for following allowing as the install occurs. # an error. It is also useful for following allowing as the install occurs.
set -o xtrace set -o xtrace
* Settings and configuration are stored in ``exerciserc``, which must be
sourced after ``openrc`` or ``stackrc``::
# Import exercise configuration
source $TOP_DIR/exerciserc
* There are a couple of helper functions in the common ``functions`` sub-script * There are a couple of helper functions in the common ``functions`` sub-script
that will check for non-zero exit codes and unset environment variables and that will check for non-zero exit codes and unset environment variables and
print a message and exit the script. These should be called after most client print a message and exit the script. These should be called after most client

22
exerciserc Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
#
# source exerciserc
#
# Configure the DevStack exercise scripts
# For best results, source this _after_ stackrc/localrc as it will set
# values only if they are not already set.
# Max time to wait while vm goes from build to active state
export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
# Max time to wait for proper IP association and dis-association.
export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
# Max time till the vm is bootable
export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
# Max time from run instance command until it is running
export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))}
# Max time to wait for a vm to terminate
export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}

View File

@ -28,6 +28,9 @@ source $TOP_DIR/functions
# Import EC2 configuration # Import EC2 configuration
source $TOP_DIR/eucarc source $TOP_DIR/eucarc
# Import exercise configuration
source $TOP_DIR/exerciserc
# Remove old certificates # Remove old certificates
rm -f $TOP_DIR/cacert.pem rm -f $TOP_DIR/cacert.pem
rm -f $TOP_DIR/cert.pem rm -f $TOP_DIR/cert.pem

View File

@ -22,6 +22,9 @@ source $TOP_DIR/functions
# Import configuration # Import configuration
source $TOP_DIR/openrc source $TOP_DIR/openrc
# Import exercise configuration
source $TOP_DIR/exerciserc
# Unset all of the known NOVA_ vars # Unset all of the known NOVA_ vars
unset NOVA_API_KEY unset NOVA_API_KEY
unset NOVA_ENDPOINT_NAME unset NOVA_ENDPOINT_NAME

View File

@ -28,14 +28,8 @@ source $TOP_DIR/functions
# Import EC2 configuration # Import EC2 configuration
source $TOP_DIR/eucarc source $TOP_DIR/eucarc
# Max time to wait while vm goes from build to active state # Import exercise configuration
ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} source $TOP_DIR/exerciserc
# Max time till the vm is bootable
BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
# Max time to wait for proper association and dis-association.
ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
# Instance type to create # Instance type to create
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny} DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

View File

@ -23,24 +23,18 @@ set -o xtrace
# Settings # Settings
# ======== # ========
# Use openrc + stackrc + localrc for settings # Keep track of the current directory
pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
# Import common functions # Import common functions
source ./functions source $TOP_DIR/functions
# Import configuration # Import configuration
source ./openrc source $TOP_DIR/openrc
popd >/dev/null
# Max time to wait while vm goes from build to active state # Import exercise configuration
ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} source $TOP_DIR/exerciserc
# Max time till the vm is bootable
BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
# Max time to wait for proper association and dis-association.
ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
# Instance type to create # Instance type to create
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny} DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

View File

@ -18,15 +18,18 @@ set -o xtrace
# Settings # Settings
# ======== # ========
# Use openrc + stackrc + localrc for settings # Keep track of the current directory
pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
# Import common functions # Import common functions
source ./functions source $TOP_DIR/functions
# Import configuration # Import configuration
source ./openrc source $TOP_DIR/openrc
popd >/dev/null
# Import exercise configuration
source $TOP_DIR/exerciserc
# Container name # Container name
CONTAINER=ex-swift CONTAINER=ex-swift

View File

@ -18,24 +18,18 @@ set -o xtrace
# Settings # Settings
# ======== # ========
# Use openrc + stackrc + localrc for settings # Keep track of the current directory
pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null EXERCISE_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=$(cd $EXERCISE_DIR/..; pwd)
# Import common functions # Import common functions
source ./functions source $TOP_DIR/functions
# Import configuration # Import configuration
source ./openrc source $TOP_DIR/openrc
popd >/dev/null
# Max time to wait while vm goes from build to active state # Import exercise configuration
ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} source $TOP_DIR/exerciserc
# Max time till the vm is bootable
BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
# Max time to wait for proper association and dis-association.
ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
# Instance type to create # Instance type to create
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny} DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny}

15
openrc
View File

@ -65,18 +65,3 @@ export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
# set log level to DEBUG (helps debug issues) # set log level to DEBUG (helps debug issues)
# export KEYSTONECLIENT_DEBUG=1 # export KEYSTONECLIENT_DEBUG=1
# export NOVACLIENT_DEBUG=1 # export NOVACLIENT_DEBUG=1
# Max time till the vm is bootable
export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30}
# Max time to wait while vm goes from build to active state
export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30}
# Max time from run instance command until it is running
export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))}
# Max time to wait for proper IP association and dis-association.
export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15}
# Max time to wait for a vm to terminate
export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30}