* Move timeouts from openrc to (new) exerciserc
* Update all exercise scripts
* Update HACKING.rst
Fixes bug 951315
Change-Id: Icc4ff03a7dcf0cc711e204046176fb5186990c17
... | ... |
@@ -43,15 +43,14 @@ Many scripts will utilize shared functions from the ``functions`` file. There a |
43 | 43 |
also rc files (``stackrc`` and ``openrc``) that are often included to set the primary |
44 | 44 |
configuration of the user environment:: |
45 | 45 |
|
46 |
- # Use openrc + stackrc + localrc for settings |
|
47 |
- pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null |
|
46 |
+ # Keep track of the current devstack directory. |
|
47 |
+ TOP_DIR=$(cd $(dirname "$0") && pwd) |
|
48 | 48 |
|
49 | 49 |
# Import common functions |
50 |
- source ./functions |
|
50 |
+ source $TOP_DIR/functions |
|
51 | 51 |
|
52 | 52 |
# Import configuration |
53 |
- source ./openrc |
|
54 |
- popd >/dev/null |
|
53 |
+ source $TOP_DIR/openrc |
|
55 | 54 |
|
56 | 55 |
``stack.sh`` is a rather large monolithic script that flows through from beginning |
57 | 56 |
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. |
119 | 119 |
# an error. It is also useful for following allowing as the install occurs. |
120 | 120 |
set -o xtrace |
121 | 121 |
|
122 |
+* Settings and configuration are stored in ``exerciserc``, which must be |
|
123 |
+ sourced after ``openrc`` or ``stackrc``:: |
|
124 |
+ |
|
125 |
+ # Import exercise configuration |
|
126 |
+ source $TOP_DIR/exerciserc |
|
127 |
+ |
|
122 | 128 |
* There are a couple of helper functions in the common ``functions`` sub-script |
123 | 129 |
that will check for non-zero exit codes and unset environment variables and |
124 | 130 |
print a message and exit the script. These should be called after most client |
125 | 131 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,22 @@ |
0 |
+#!/usr/bin/env bash |
|
1 |
+# |
|
2 |
+# source exerciserc |
|
3 |
+# |
|
4 |
+# Configure the DevStack exercise scripts |
|
5 |
+# For best results, source this _after_ stackrc/localrc as it will set |
|
6 |
+# values only if they are not already set. |
|
7 |
+ |
|
8 |
+# Max time to wait while vm goes from build to active state |
|
9 |
+export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} |
|
10 |
+ |
|
11 |
+# Max time to wait for proper IP association and dis-association. |
|
12 |
+export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15} |
|
13 |
+ |
|
14 |
+# Max time till the vm is bootable |
|
15 |
+export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30} |
|
16 |
+ |
|
17 |
+# Max time from run instance command until it is running |
|
18 |
+export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))} |
|
19 |
+ |
|
20 |
+# Max time to wait for a vm to terminate |
|
21 |
+export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30} |
... | ... |
@@ -28,14 +28,8 @@ source $TOP_DIR/functions |
28 | 28 |
# Import EC2 configuration |
29 | 29 |
source $TOP_DIR/eucarc |
30 | 30 |
|
31 |
-# Max time to wait while vm goes from build to active state |
|
32 |
-ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} |
|
33 |
- |
|
34 |
-# Max time till the vm is bootable |
|
35 |
-BOOT_TIMEOUT=${BOOT_TIMEOUT:-30} |
|
36 |
- |
|
37 |
-# Max time to wait for proper association and dis-association. |
|
38 |
-ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15} |
|
31 |
+# Import exercise configuration |
|
32 |
+source $TOP_DIR/exerciserc |
|
39 | 33 |
|
40 | 34 |
# Instance type to create |
41 | 35 |
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny} |
... | ... |
@@ -23,24 +23,18 @@ set -o xtrace |
23 | 23 |
# Settings |
24 | 24 |
# ======== |
25 | 25 |
|
26 |
-# Use openrc + stackrc + localrc for settings |
|
27 |
-pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null |
|
26 |
+# Keep track of the current directory |
|
27 |
+EXERCISE_DIR=$(cd $(dirname "$0") && pwd) |
|
28 |
+TOP_DIR=$(cd $EXERCISE_DIR/..; pwd) |
|
28 | 29 |
|
29 | 30 |
# Import common functions |
30 |
-source ./functions |
|
31 |
+source $TOP_DIR/functions |
|
31 | 32 |
|
32 | 33 |
# Import configuration |
33 |
-source ./openrc |
|
34 |
-popd >/dev/null |
|
34 |
+source $TOP_DIR/openrc |
|
35 | 35 |
|
36 |
-# Max time to wait while vm goes from build to active state |
|
37 |
-ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} |
|
38 |
- |
|
39 |
-# Max time till the vm is bootable |
|
40 |
-BOOT_TIMEOUT=${BOOT_TIMEOUT:-30} |
|
41 |
- |
|
42 |
-# Max time to wait for proper association and dis-association. |
|
43 |
-ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15} |
|
36 |
+# Import exercise configuration |
|
37 |
+source $TOP_DIR/exerciserc |
|
44 | 38 |
|
45 | 39 |
# Instance type to create |
46 | 40 |
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny} |
... | ... |
@@ -18,15 +18,18 @@ set -o xtrace |
18 | 18 |
# Settings |
19 | 19 |
# ======== |
20 | 20 |
|
21 |
-# Use openrc + stackrc + localrc for settings |
|
22 |
-pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null |
|
21 |
+# Keep track of the current directory |
|
22 |
+EXERCISE_DIR=$(cd $(dirname "$0") && pwd) |
|
23 |
+TOP_DIR=$(cd $EXERCISE_DIR/..; pwd) |
|
23 | 24 |
|
24 | 25 |
# Import common functions |
25 |
-source ./functions |
|
26 |
+source $TOP_DIR/functions |
|
26 | 27 |
|
27 | 28 |
# Import configuration |
28 |
-source ./openrc |
|
29 |
-popd >/dev/null |
|
29 |
+source $TOP_DIR/openrc |
|
30 |
+ |
|
31 |
+# Import exercise configuration |
|
32 |
+source $TOP_DIR/exerciserc |
|
30 | 33 |
|
31 | 34 |
# Container name |
32 | 35 |
CONTAINER=ex-swift |
... | ... |
@@ -18,24 +18,18 @@ set -o xtrace |
18 | 18 |
# Settings |
19 | 19 |
# ======== |
20 | 20 |
|
21 |
-# Use openrc + stackrc + localrc for settings |
|
22 |
-pushd $(cd $(dirname "$0")/.. && pwd) >/dev/null |
|
21 |
+# Keep track of the current directory |
|
22 |
+EXERCISE_DIR=$(cd $(dirname "$0") && pwd) |
|
23 |
+TOP_DIR=$(cd $EXERCISE_DIR/..; pwd) |
|
23 | 24 |
|
24 | 25 |
# Import common functions |
25 |
-source ./functions |
|
26 |
+source $TOP_DIR/functions |
|
26 | 27 |
|
27 | 28 |
# Import configuration |
28 |
-source ./openrc |
|
29 |
-popd >/dev/null |
|
29 |
+source $TOP_DIR/openrc |
|
30 | 30 |
|
31 |
-# Max time to wait while vm goes from build to active state |
|
32 |
-ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} |
|
33 |
- |
|
34 |
-# Max time till the vm is bootable |
|
35 |
-BOOT_TIMEOUT=${BOOT_TIMEOUT:-30} |
|
36 |
- |
|
37 |
-# Max time to wait for proper association and dis-association. |
|
38 |
-ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15} |
|
31 |
+# Import exercise configuration |
|
32 |
+source $TOP_DIR/exerciserc |
|
39 | 33 |
|
40 | 34 |
# Instance type to create |
41 | 35 |
DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny} |
... | ... |
@@ -65,18 +65,3 @@ export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION} |
65 | 65 |
# set log level to DEBUG (helps debug issues) |
66 | 66 |
# export KEYSTONECLIENT_DEBUG=1 |
67 | 67 |
# export NOVACLIENT_DEBUG=1 |
68 |
- |
|
69 |
-# Max time till the vm is bootable |
|
70 |
-export BOOT_TIMEOUT=${BOOT_TIMEOUT:-30} |
|
71 |
- |
|
72 |
-# Max time to wait while vm goes from build to active state |
|
73 |
-export ACTIVE_TIMEOUT=${ACTIVE_TIMEOUT:-30} |
|
74 |
- |
|
75 |
-# Max time from run instance command until it is running |
|
76 |
-export RUNNING_TIMEOUT=${RUNNING_TIMEOUT:-$(($BOOT_TIMEOUT + $ACTIVE_TIMEOUT))} |
|
77 |
- |
|
78 |
-# Max time to wait for proper IP association and dis-association. |
|
79 |
-export ASSOCIATE_TIMEOUT=${ASSOCIATE_TIMEOUT:-15} |
|
80 |
- |
|
81 |
-# Max time to wait for a vm to terminate |
|
82 |
-export TERMINATE_TIMEOUT=${TERMINATE_TIMEOUT:-30} |