Split build_ci_config.sh into:
* tools/build_tempest.sh - checks out Tempest and installs prereqs
* tools/configure_tempest.sh - creates tempest.conf from devstack
Change-Id: I22f40226afb617a5a6e32f2631b07d5509f10b13
... | ... |
@@ -42,9 +42,9 @@ QUANTUM_BRANCH=master |
42 | 42 |
QUANTUM_CLIENT_REPO=https://github.com/openstack/python-quantumclient |
43 | 43 |
QUANTUM_CLIENT_BRANCH=master |
44 | 44 |
|
45 |
-# CI test suite |
|
46 |
-CITEST_REPO=https://github.com/openstack/tempest.git |
|
47 |
-CITEST_BRANCH=master |
|
45 |
+# Tempest test suite |
|
46 |
+TEMPEST_REPO=https://github.com/openstack/tempest.git |
|
47 |
+TEMPEST_BRANCH=master |
|
48 | 48 |
|
49 | 49 |
# Specify a comma-separated list of uec images to download and install into glance. |
50 | 50 |
# supported urls here are: |
51 | 51 |
deleted file mode 100755 |
... | ... |
@@ -1,262 +0,0 @@ |
1 |
-#!/usr/bin/env bash |
|
2 |
-# |
|
3 |
-# build_ci_config.sh - Build a config.ini for tempest (openstack-integration-tests) |
|
4 |
-# (https://github.com/openstack/tempest.git) |
|
5 |
- |
|
6 |
-function usage { |
|
7 |
- echo "$0 - Build config.ini for tempest" |
|
8 |
- echo "" |
|
9 |
- echo "Usage: $0 [configdir]" |
|
10 |
- exit 1 |
|
11 |
-} |
|
12 |
- |
|
13 |
-if [ "$1" = "-h" ]; then |
|
14 |
- usage |
|
15 |
-fi |
|
16 |
- |
|
17 |
-# Clean up any resources that may be in use |
|
18 |
-cleanup() { |
|
19 |
- set +o errexit |
|
20 |
- |
|
21 |
- # Mop up temporary files |
|
22 |
- if [ -n "$CONFIG_CONF_TMP" -a -e "$CONFIG_CONF_TMP" ]; then |
|
23 |
- rm -f $CONFIG_CONF_TMP |
|
24 |
- fi |
|
25 |
- if [ -n "$CONFIG_INI_TMP" -a -e "$CONFIG_INI_TMP" ]; then |
|
26 |
- rm -f $CONFIG_INI_TMP |
|
27 |
- fi |
|
28 |
- |
|
29 |
- # Kill ourselves to signal any calling process |
|
30 |
- trap 2; kill -2 $$ |
|
31 |
-} |
|
32 |
- |
|
33 |
-trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT |
|
34 |
- |
|
35 |
-# Keep track of the current directory |
|
36 |
-TOOLS_DIR=$(cd $(dirname "$0") && pwd) |
|
37 |
-TOP_DIR=`cd $TOOLS_DIR/..; pwd` |
|
38 |
- |
|
39 |
-# Abort if localrc is not set |
|
40 |
-if [ ! -e $TOP_DIR/localrc ]; then |
|
41 |
- echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding." |
|
42 |
- echo "See stack.sh for required passwords." |
|
43 |
- exit 1 |
|
44 |
-fi |
|
45 |
- |
|
46 |
-# Source params |
|
47 |
-source ./stackrc |
|
48 |
- |
|
49 |
-# Where Openstack code lives |
|
50 |
-DEST=${DEST:-/opt/stack} |
|
51 |
- |
|
52 |
-CITEST_DIR=$DEST/tempest |
|
53 |
- |
|
54 |
-CONFIG_DIR=${1:-$CITEST_DIR/etc} |
|
55 |
-CONFIG_CONF=$CONFIG_DIR/storm.conf |
|
56 |
-CONFIG_INI=$CONFIG_DIR/config.ini |
|
57 |
- |
|
58 |
-DIST_NAME=${DIST_NAME:-oneiric} |
|
59 |
- |
|
60 |
-# git clone only if directory doesn't exist already. Since ``DEST`` might not |
|
61 |
-# be owned by the installation user, we create the directory and change the |
|
62 |
-# ownership to the proper user. |
|
63 |
-function git_clone { |
|
64 |
- |
|
65 |
- GIT_REMOTE=$1 |
|
66 |
- GIT_DEST=$2 |
|
67 |
- GIT_BRANCH=$3 |
|
68 |
- |
|
69 |
- # do a full clone only if the directory doesn't exist |
|
70 |
- if [ ! -d $GIT_DEST ]; then |
|
71 |
- git clone $GIT_REMOTE $GIT_DEST |
|
72 |
- cd $2 |
|
73 |
- # This checkout syntax works for both branches and tags |
|
74 |
- git checkout $GIT_BRANCH |
|
75 |
- elif [[ "$RECLONE" == "yes" ]]; then |
|
76 |
- # if it does exist then simulate what clone does if asked to RECLONE |
|
77 |
- cd $GIT_DEST |
|
78 |
- # set the url to pull from and fetch |
|
79 |
- git remote set-url origin $GIT_REMOTE |
|
80 |
- git fetch origin |
|
81 |
- # remove the existing ignored files (like pyc) as they cause breakage |
|
82 |
- # (due to the py files having older timestamps than our pyc, so python |
|
83 |
- # thinks the pyc files are correct using them) |
|
84 |
- find $GIT_DEST -name '*.pyc' -delete |
|
85 |
- git checkout -f origin/$GIT_BRANCH |
|
86 |
- # a local branch might not exist |
|
87 |
- git branch -D $GIT_BRANCH || true |
|
88 |
- git checkout -b $GIT_BRANCH |
|
89 |
- fi |
|
90 |
-} |
|
91 |
- |
|
92 |
-# Install tests and prerequisites |
|
93 |
-sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install --use-mirrors `cat $TOP_DIR/files/pips/tempest` |
|
94 |
- |
|
95 |
-git_clone $CITEST_REPO $CITEST_DIR $CITEST_BRANCH |
|
96 |
- |
|
97 |
-if [ ! -f $DEST/.ramdisk ]; then |
|
98 |
- # Process network configuration vars |
|
99 |
- GUEST_NETWORK=${GUEST_NETWORK:-1} |
|
100 |
- GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes} |
|
101 |
- |
|
102 |
- GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50} |
|
103 |
- GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24} |
|
104 |
- GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0} |
|
105 |
- GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1} |
|
106 |
- GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"} |
|
107 |
- GUEST_RAM=${GUEST_RAM:-1524288} |
|
108 |
- GUEST_CORES=${GUEST_CORES:-1} |
|
109 |
-fi |
|
110 |
- |
|
111 |
-# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP`` |
|
112 |
-HOST_IP=${HOST_IP:-$GUEST_IP} |
|
113 |
-# Use the first IP if HOST_IP still is not set |
|
114 |
-if [ ! -n "$HOST_IP" ]; then |
|
115 |
- HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'` |
|
116 |
-fi |
|
117 |
- |
|
118 |
-RABBIT_HOST=${RABBIT_HOST:-localhost} |
|
119 |
- |
|
120 |
-# Glance connection info. Note the port must be specified. |
|
121 |
-GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292} |
|
122 |
-set `echo $GLANCE_HOSTPORT | tr ':' ' '` |
|
123 |
-GLANCE_HOST=$1 |
|
124 |
-GLANCE_PORT=$2 |
|
125 |
- |
|
126 |
-# Set up downloaded images |
|
127 |
-# Defaults to use first image |
|
128 |
- |
|
129 |
-IMAGE_DIR="" |
|
130 |
-for imagedir in $TOP_DIR/files/images/*; do |
|
131 |
- KERNEL="" |
|
132 |
- RAMDISK="" |
|
133 |
- IMAGE="" |
|
134 |
- IMAGE_RAMDISK="" |
|
135 |
- KERNEL=$(for f in "$imagedir/"*-vmlinuz*; do |
|
136 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
137 |
- [ -n "$KERNEL" ] && ln -sf $KERNEL $imagedir/kernel |
|
138 |
- RAMDISK=$(for f in "$imagedir/"*-initrd*; do |
|
139 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
140 |
- [ -n "$RAMDISK" ] && ln -sf $RAMDISK $imagedir/ramdisk && \ |
|
141 |
- IMAGE_RAMDISK="ari_location = $imagedir/ramdisk" |
|
142 |
- IMAGE=$(for f in "$imagedir/"*.img; do |
|
143 |
- [ -f "$f" ] && echo "$f" && break; done; true) |
|
144 |
- if [ -n "$IMAGE" ]; then |
|
145 |
- ln -sf $IMAGE $imagedir/disk |
|
146 |
- # Save the first image directory that contains a disk image link |
|
147 |
- if [ -z "$IMAGE_DIR" ]; then |
|
148 |
- IMAGE_DIR=$imagedir |
|
149 |
- fi |
|
150 |
- fi |
|
151 |
-done |
|
152 |
- |
|
153 |
-# Create storm.conf |
|
154 |
- |
|
155 |
-CONFIG_CONF_TMP=$(mktemp $CONFIG_CONF.XXXXXX) |
|
156 |
- cat >$CONFIG_CONF_TMP <<EOF |
|
157 |
-[nova] |
|
158 |
-auth_url=http://$HOST_IP:5000/v2.0/tokens |
|
159 |
-user=admin |
|
160 |
-api_key=$ADMIN_PASSWORD |
|
161 |
-tenant_name=admin |
|
162 |
-ssh_timeout=300 |
|
163 |
-build_interval=10 |
|
164 |
-build_timeout=600 |
|
165 |
- |
|
166 |
-[environment] |
|
167 |
-image_ref=3 |
|
168 |
-image_ref_alt=4 |
|
169 |
-flavor_ref=1 |
|
170 |
-flavor_ref_alt=2 |
|
171 |
-create_image_enabled=true |
|
172 |
-resize_available=true |
|
173 |
-authentication=keystone_v2 |
|
174 |
-EOF |
|
175 |
-mv $CONFIG_CONF_TMP $CONFIG_CONF |
|
176 |
-CONFIG_CONF_TMP="" |
|
177 |
- |
|
178 |
-# Create config.ini |
|
179 |
- |
|
180 |
-CONFIG_INI_TMP=$(mktemp $CONFIG_INI.XXXXXX) |
|
181 |
-if [ "$UPLOAD_LEGACY_TTY" ]; then |
|
182 |
- cat >$CONFIG_INI_TMP <<EOF |
|
183 |
-[environment] |
|
184 |
-aki_location = $TOP_DIR/files/images/aki-tty/image |
|
185 |
-ari_location = $TOP_DIR/files/images/ari-tty/image |
|
186 |
-ami_location = $TOP_DIR/files/images/ami-tty/image |
|
187 |
-image_ref = 3 |
|
188 |
-image_ref_alt = 3 |
|
189 |
-flavor_ref = 1 |
|
190 |
-flavor_ref_alt = 2 |
|
191 |
- |
|
192 |
-[glance] |
|
193 |
-host = $GLANCE_HOST |
|
194 |
-apiver = v1 |
|
195 |
-port = $GLANCE_PORT |
|
196 |
-image_id = 3 |
|
197 |
-image_id_alt = 3 |
|
198 |
-tenant_id = 1 |
|
199 |
-EOF |
|
200 |
-else |
|
201 |
- cat >$CONFIG_INI_TMP <<EOF |
|
202 |
-[environment] |
|
203 |
-aki_location = $IMAGE_DIR/kernel |
|
204 |
-ami_location = $IMAGE_DIR/disk |
|
205 |
-$IMAGE_RAMDISK |
|
206 |
-image_ref = 2 |
|
207 |
-image_ref_alt = 2 |
|
208 |
-flavor_ref = 1 |
|
209 |
-flavor_ref_alt = 2 |
|
210 |
- |
|
211 |
-[glance] |
|
212 |
-host = $GLANCE_HOST |
|
213 |
-apiver = v1 |
|
214 |
-port = $GLANCE_PORT |
|
215 |
-image_id = 2 |
|
216 |
-image_id_alt = 2 |
|
217 |
-tenant_id = 1 |
|
218 |
-EOF |
|
219 |
-fi |
|
220 |
- |
|
221 |
-cat >>$CONFIG_INI_TMP <<EOF |
|
222 |
- |
|
223 |
-[keystone] |
|
224 |
-service_host = $HOST_IP |
|
225 |
-service_port = 5000 |
|
226 |
-apiver = v2.0 |
|
227 |
-user = admin |
|
228 |
-password = $ADMIN_PASSWORD |
|
229 |
-tenant_name = admin |
|
230 |
- |
|
231 |
-[nova] |
|
232 |
-host = $HOST_IP |
|
233 |
-port = 8774 |
|
234 |
-apiver = v1.1 |
|
235 |
-project = admin |
|
236 |
-user = admin |
|
237 |
-key = $ADMIN_PASSWORD |
|
238 |
-ssh_timeout = 300 |
|
239 |
-build_timeout = 300 |
|
240 |
-flavor_ref = 1 |
|
241 |
-flavor_ref_alt = 2 |
|
242 |
-multi_node = no |
|
243 |
- |
|
244 |
-[rabbitmq] |
|
245 |
-host = $RABBIT_HOST |
|
246 |
-user = guest |
|
247 |
-password = $RABBIT_PASSWORD |
|
248 |
- |
|
249 |
-[swift] |
|
250 |
-auth_host = $HOST_IP |
|
251 |
-auth_port = 443 |
|
252 |
-auth_prefix = /auth/ |
|
253 |
-auth_ssl = yes |
|
254 |
-account = system |
|
255 |
-username = root |
|
256 |
-password = password |
|
257 |
- |
|
258 |
-EOF |
|
259 |
-mv $CONFIG_INI_TMP $CONFIG_INI |
|
260 |
-CONFIG_INI_TMP="" |
|
261 |
- |
|
262 |
-trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT |
263 | 1 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,85 @@ |
0 |
+#!/usr/bin/env bash |
|
1 |
+# |
|
2 |
+# build_tempest.sh - Checkout and prepare a Tempest repo |
|
3 |
+# (https://github.com/openstack/tempest.git) |
|
4 |
+ |
|
5 |
+function usage { |
|
6 |
+ echo "$0 - Check out and prepare a Tempest repo" |
|
7 |
+ echo "" |
|
8 |
+ echo "Usage: $0" |
|
9 |
+ exit 1 |
|
10 |
+} |
|
11 |
+ |
|
12 |
+if [ "$1" = "-h" ]; then |
|
13 |
+ usage |
|
14 |
+fi |
|
15 |
+ |
|
16 |
+# Clean up any resources that may be in use |
|
17 |
+cleanup() { |
|
18 |
+ set +o errexit |
|
19 |
+ |
|
20 |
+ # Kill ourselves to signal any calling process |
|
21 |
+ trap 2; kill -2 $$ |
|
22 |
+} |
|
23 |
+ |
|
24 |
+trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT |
|
25 |
+ |
|
26 |
+# Keep track of the current directory |
|
27 |
+TOOLS_DIR=$(cd $(dirname "$0") && pwd) |
|
28 |
+TOP_DIR=`cd $TOOLS_DIR/..; pwd` |
|
29 |
+ |
|
30 |
+# Abort if localrc is not set |
|
31 |
+if [ ! -e $TOP_DIR/localrc ]; then |
|
32 |
+ echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding." |
|
33 |
+ echo "See stack.sh for required passwords." |
|
34 |
+ exit 1 |
|
35 |
+fi |
|
36 |
+ |
|
37 |
+# Source params |
|
38 |
+source ./stackrc |
|
39 |
+ |
|
40 |
+# Where Openstack code lives |
|
41 |
+DEST=${DEST:-/opt/stack} |
|
42 |
+ |
|
43 |
+TEMPEST_DIR=$DEST/tempest |
|
44 |
+ |
|
45 |
+DIST_NAME=${DIST_NAME:-oneiric} |
|
46 |
+ |
|
47 |
+# git clone only if directory doesn't exist already. Since ``DEST`` might not |
|
48 |
+# be owned by the installation user, we create the directory and change the |
|
49 |
+# ownership to the proper user. |
|
50 |
+function git_clone { |
|
51 |
+ |
|
52 |
+ GIT_REMOTE=$1 |
|
53 |
+ GIT_DEST=$2 |
|
54 |
+ GIT_BRANCH=$3 |
|
55 |
+ |
|
56 |
+ # do a full clone only if the directory doesn't exist |
|
57 |
+ if [ ! -d $GIT_DEST ]; then |
|
58 |
+ git clone $GIT_REMOTE $GIT_DEST |
|
59 |
+ cd $2 |
|
60 |
+ # This checkout syntax works for both branches and tags |
|
61 |
+ git checkout $GIT_BRANCH |
|
62 |
+ elif [[ "$RECLONE" == "yes" ]]; then |
|
63 |
+ # if it does exist then simulate what clone does if asked to RECLONE |
|
64 |
+ cd $GIT_DEST |
|
65 |
+ # set the url to pull from and fetch |
|
66 |
+ git remote set-url origin $GIT_REMOTE |
|
67 |
+ git fetch origin |
|
68 |
+ # remove the existing ignored files (like pyc) as they cause breakage |
|
69 |
+ # (due to the py files having older timestamps than our pyc, so python |
|
70 |
+ # thinks the pyc files are correct using them) |
|
71 |
+ find $GIT_DEST -name '*.pyc' -delete |
|
72 |
+ git checkout -f origin/$GIT_BRANCH |
|
73 |
+ # a local branch might not exist |
|
74 |
+ git branch -D $GIT_BRANCH || true |
|
75 |
+ git checkout -b $GIT_BRANCH |
|
76 |
+ fi |
|
77 |
+} |
|
78 |
+ |
|
79 |
+# Install tests and prerequisites |
|
80 |
+sudo PIP_DOWNLOAD_CACHE=/var/cache/pip pip install --use-mirrors `cat $TOP_DIR/files/pips/tempest` |
|
81 |
+ |
|
82 |
+git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH |
|
83 |
+ |
|
84 |
+trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT |
... | ... |
@@ -149,7 +149,7 @@ git_clone $NOVNC_REPO $DEST/novnc $NOVNC_BRANCH |
149 | 149 |
git_clone $HORIZON_REPO $DEST/horizon $HORIZON_BRANCH |
150 | 150 |
git_clone $NOVACLIENT_REPO $DEST/python-novaclient $NOVACLIENT_BRANCH |
151 | 151 |
git_clone $OPENSTACKX_REPO $DEST/openstackx $OPENSTACKX_BRANCH |
152 |
-git_clone $CITEST_REPO $DEST/tempest $CITEST_BRANCH |
|
152 |
+git_clone $TEMPEST_REPO $DEST/tempest $TEMPEST_BRANCH |
|
153 | 153 |
|
154 | 154 |
# Use this version of devstack |
155 | 155 |
rm -rf $MNT_DIR/$DEST/devstack |
156 | 156 |
new file mode 100755 |
... | ... |
@@ -0,0 +1,227 @@ |
0 |
+#!/usr/bin/env bash |
|
1 |
+# |
|
2 |
+# configure_tempest.sh - Build a tempest configuration file from devstack |
|
3 |
+ |
|
4 |
+function usage { |
|
5 |
+ echo "$0 - Build tempest.conf" |
|
6 |
+ echo "" |
|
7 |
+ echo "Usage: $0 [configdir]" |
|
8 |
+ exit 1 |
|
9 |
+} |
|
10 |
+ |
|
11 |
+if [ "$1" = "-h" ]; then |
|
12 |
+ usage |
|
13 |
+fi |
|
14 |
+ |
|
15 |
+# Clean up any resources that may be in use |
|
16 |
+cleanup() { |
|
17 |
+ set +o errexit |
|
18 |
+ |
|
19 |
+ # Mop up temporary files |
|
20 |
+ if [ -n "$CONFIG_INI_TMP" -a -e "$CONFIG_INI_TMP" ]; then |
|
21 |
+ rm -f $CONFIG_INI_TMP |
|
22 |
+ fi |
|
23 |
+ |
|
24 |
+ # Kill ourselves to signal any calling process |
|
25 |
+ trap 2; kill -2 $$ |
|
26 |
+} |
|
27 |
+ |
|
28 |
+trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT |
|
29 |
+ |
|
30 |
+# Keep track of the current directory |
|
31 |
+TOOLS_DIR=$(cd $(dirname "$0") && pwd) |
|
32 |
+TOP_DIR=`cd $TOOLS_DIR/..; pwd` |
|
33 |
+ |
|
34 |
+# Abort if localrc is not set |
|
35 |
+if [ ! -e $TOP_DIR/localrc ]; then |
|
36 |
+ echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding." |
|
37 |
+ echo "See stack.sh for required passwords." |
|
38 |
+ exit 1 |
|
39 |
+fi |
|
40 |
+ |
|
41 |
+# Source params |
|
42 |
+source ./stackrc |
|
43 |
+ |
|
44 |
+# Set defaults not configured by stackrc |
|
45 |
+TENANT=${TENANT:-admin} |
|
46 |
+USERNAME=${USERNAME:-admin} |
|
47 |
+IDENTITY_HOST=${IDENTITY_HOST:-$HOST_IP} |
|
48 |
+IDENTITY_PORT=${IDENTITY_PORT:-5000} |
|
49 |
+IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0} |
|
50 |
+ |
|
51 |
+# Where Openstack code lives |
|
52 |
+DEST=${DEST:-/opt/stack} |
|
53 |
+ |
|
54 |
+TEMPEST_DIR=$DEST/tempest |
|
55 |
+ |
|
56 |
+CONFIG_DIR=${1:-$TEMPEST_DIR/etc} |
|
57 |
+CONFIG_INI=$CONFIG_DIR/config.ini |
|
58 |
+TEMPEST_CONF=$CONFIG_DIR/tempest.conf |
|
59 |
+ |
|
60 |
+if [ ! -f $DEST/.ramdisk ]; then |
|
61 |
+ # Process network configuration vars |
|
62 |
+ GUEST_NETWORK=${GUEST_NETWORK:-1} |
|
63 |
+ GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes} |
|
64 |
+ |
|
65 |
+ GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50} |
|
66 |
+ GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24} |
|
67 |
+ GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0} |
|
68 |
+ GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1} |
|
69 |
+ GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"} |
|
70 |
+ GUEST_RAM=${GUEST_RAM:-1524288} |
|
71 |
+ GUEST_CORES=${GUEST_CORES:-1} |
|
72 |
+fi |
|
73 |
+ |
|
74 |
+# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP`` |
|
75 |
+HOST_IP=${HOST_IP:-$GUEST_IP} |
|
76 |
+# Use the first IP if HOST_IP still is not set |
|
77 |
+if [ ! -n "$HOST_IP" ]; then |
|
78 |
+ HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'` |
|
79 |
+fi |
|
80 |
+ |
|
81 |
+RABBIT_HOST=${RABBIT_HOST:-localhost} |
|
82 |
+ |
|
83 |
+# Glance connection info. Note the port must be specified. |
|
84 |
+GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292} |
|
85 |
+set `echo $GLANCE_HOSTPORT | tr ':' ' '` |
|
86 |
+GLANCE_HOST=$1 |
|
87 |
+GLANCE_PORT=$2 |
|
88 |
+ |
|
89 |
+# Set up downloaded images |
|
90 |
+# Defaults to use first image |
|
91 |
+ |
|
92 |
+IMAGE_DIR="" |
|
93 |
+IMAGE_NAME="" |
|
94 |
+for imagedir in $TOP_DIR/files/images/*; do |
|
95 |
+ KERNEL="" |
|
96 |
+ RAMDISK="" |
|
97 |
+ IMAGE="" |
|
98 |
+ IMAGE_RAMDISK="" |
|
99 |
+ KERNEL=$(for f in "$imagedir/"*-vmlinuz*; do |
|
100 |
+ [ -f "$f" ] && echo "$f" && break; done; true) |
|
101 |
+ [ -n "$KERNEL" ] && ln -sf $KERNEL $imagedir/kernel |
|
102 |
+ RAMDISK=$(for f in "$imagedir/"*-initrd*; do |
|
103 |
+ [ -f "$f" ] && echo "$f" && break; done; true) |
|
104 |
+ [ -n "$RAMDISK" ] && ln -sf $RAMDISK $imagedir/ramdisk && \ |
|
105 |
+ IMAGE_RAMDISK="ari_location = $imagedir/ramdisk" |
|
106 |
+ IMAGE=$(for f in "$imagedir/"*.img; do |
|
107 |
+ [ -f "$f" ] && echo "$f" && break; done; true) |
|
108 |
+ if [ -n "$IMAGE" ]; then |
|
109 |
+ ln -sf $IMAGE $imagedir/disk |
|
110 |
+ # Save the first image directory that contains a disk image link |
|
111 |
+ if [ -z "$IMAGE_DIR" ]; then |
|
112 |
+ IMAGE_DIR=$imagedir |
|
113 |
+ IMAGE_NAME=$(basename ${IMAGE%.img}) |
|
114 |
+ fi |
|
115 |
+ fi |
|
116 |
+done |
|
117 |
+if [[ -n "$IMAGE_NAME" ]]; then |
|
118 |
+ # Get the image UUID |
|
119 |
+ IMAGE_UUID=$(nova image-list | grep " $IMAGE_NAME " | cut -d'|' -f2) |
|
120 |
+ # Strip spaces off |
|
121 |
+ IMAGE_UUID=$(echo $IMAGE_UUID) |
|
122 |
+fi |
|
123 |
+ |
|
124 |
+# Create tempest.conf from tempest.conf.sample |
|
125 |
+ |
|
126 |
+if [[ ! -r $TEMPEST_CONF ]]; then |
|
127 |
+ cp $TEMPEST_CONF.sample $TEMPEST_CONF |
|
128 |
+fi |
|
129 |
+ |
|
130 |
+sed -e " |
|
131 |
+ /^api_key=/s|=.*\$|=$ADMIN_PASSWORD|; |
|
132 |
+ /^auth_url=/s|=.*\$|=${OS_AUTH_URL%/}/tokens/|; |
|
133 |
+ /^host=/s|=.*\$|=$HOST_IP|; |
|
134 |
+ /^image_ref=/s|=.*\$|=$IMAGE_UUID|; |
|
135 |
+ /^password=/s|=.*\$|=$ADMIN_PASSWORD|; |
|
136 |
+ /^tenant=/s|=.*\$|=$TENANT|; |
|
137 |
+ /^tenant_name=/s|=.*\$|=$TENANT|; |
|
138 |
+ /^user=/s|=.*\$|=$USERNAME|; |
|
139 |
+ /^username=/s|=.*\$|=$USERNAME|; |
|
140 |
+" -i $TEMPEST_CONF |
|
141 |
+ |
|
142 |
+# Create config.ini |
|
143 |
+ |
|
144 |
+CONFIG_INI_TMP=$(mktemp $CONFIG_INI.XXXXXX) |
|
145 |
+if [ "$UPLOAD_LEGACY_TTY" ]; then |
|
146 |
+ cat >$CONFIG_INI_TMP <<EOF |
|
147 |
+[environment] |
|
148 |
+aki_location = $TOP_DIR/files/images/aki-tty/image |
|
149 |
+ari_location = $TOP_DIR/files/images/ari-tty/image |
|
150 |
+ami_location = $TOP_DIR/files/images/ami-tty/image |
|
151 |
+image_ref = 3 |
|
152 |
+image_ref_alt = 3 |
|
153 |
+flavor_ref = 1 |
|
154 |
+flavor_ref_alt = 2 |
|
155 |
+ |
|
156 |
+[glance] |
|
157 |
+host = $GLANCE_HOST |
|
158 |
+apiver = v1 |
|
159 |
+port = $GLANCE_PORT |
|
160 |
+image_id = 3 |
|
161 |
+image_id_alt = 3 |
|
162 |
+tenant_id = 1 |
|
163 |
+EOF |
|
164 |
+else |
|
165 |
+ cat >$CONFIG_INI_TMP <<EOF |
|
166 |
+[environment] |
|
167 |
+aki_location = $IMAGE_DIR/kernel |
|
168 |
+ami_location = $IMAGE_DIR/disk |
|
169 |
+$IMAGE_RAMDISK |
|
170 |
+image_ref = 2 |
|
171 |
+image_ref_alt = 2 |
|
172 |
+flavor_ref = 1 |
|
173 |
+flavor_ref_alt = 2 |
|
174 |
+ |
|
175 |
+[glance] |
|
176 |
+host = $GLANCE_HOST |
|
177 |
+apiver = v1 |
|
178 |
+port = $GLANCE_PORT |
|
179 |
+image_id = 2 |
|
180 |
+image_id_alt = 2 |
|
181 |
+tenant_id = 1 |
|
182 |
+EOF |
|
183 |
+fi |
|
184 |
+ |
|
185 |
+cat >>$CONFIG_INI_TMP <<EOF |
|
186 |
+ |
|
187 |
+[keystone] |
|
188 |
+service_host = $HOST_IP |
|
189 |
+service_port = 5000 |
|
190 |
+apiver = v2.0 |
|
191 |
+user = admin |
|
192 |
+password = $ADMIN_PASSWORD |
|
193 |
+tenant_name = admin |
|
194 |
+ |
|
195 |
+[nova] |
|
196 |
+host = $HOST_IP |
|
197 |
+port = 8774 |
|
198 |
+apiver = v1.1 |
|
199 |
+project = admin |
|
200 |
+user = admin |
|
201 |
+key = $ADMIN_PASSWORD |
|
202 |
+ssh_timeout = 300 |
|
203 |
+build_timeout = 300 |
|
204 |
+flavor_ref = 1 |
|
205 |
+flavor_ref_alt = 2 |
|
206 |
+multi_node = no |
|
207 |
+ |
|
208 |
+[rabbitmq] |
|
209 |
+host = $RABBIT_HOST |
|
210 |
+user = guest |
|
211 |
+password = $RABBIT_PASSWORD |
|
212 |
+ |
|
213 |
+[swift] |
|
214 |
+auth_host = $HOST_IP |
|
215 |
+auth_port = 443 |
|
216 |
+auth_prefix = /auth/ |
|
217 |
+auth_ssl = yes |
|
218 |
+account = system |
|
219 |
+username = root |
|
220 |
+password = password |
|
221 |
+ |
|
222 |
+EOF |
|
223 |
+mv $CONFIG_INI_TMP $CONFIG_INI |
|
224 |
+CONFIG_INI_TMP="" |
|
225 |
+ |
|
226 |
+trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT |