forked from openstack-archive/devstack-gate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevstack-vm-gate.sh
More file actions
executable file
·452 lines (383 loc) · 15.8 KB
/
Copy pathdevstack-vm-gate.sh
File metadata and controls
executable file
·452 lines (383 loc) · 15.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
#!/bin/bash -xe
# Script that is run on the devstack vm; configures and
# invokes devstack.
# Copyright (C) 2011-2012 OpenStack LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
#put to job export
DEVSTACK_GATE_TEMPEST=1 #//tempest
DEVSTACK_GATE_NEUTRON=1 #// Neutron
LOCALRC_BRANCH="stable/havana"
export DEVSTACK_GATE_TEMPEST=${DEVSTACK_GATE_TEMPEST:-0}
# Set to 1 to run the devstack exercises
export DEVSTACK_GATE_EXERCISES=${DEVSTACK_GATE_EXERCISES:-0}
# Set to 1 to run postgresql instead of mysql
export DEVSTACK_GATE_POSTGRES=${DEVSTACK_GATE_POSTGRES:-0}
# Set to 1 to use zeromq instead of rabbitmq (or qpid)
export DEVSTACK_GATE_ZEROMQ=${DEVSTACK_GATE_ZEROMQ:-0}
# Set to qpid to use qpid, or zeromq to use zeromq.
# Default set to rabbitmq
export DEVSTACK_GATE_MQ_DRIVER=${DEVSTACK_GATE_MQ_DRIVER:-"rabbitmq"}
# Set to 1 to run tempest stress tests
export DEVSTACK_GATE_TEMPEST_STRESS=${DEVSTACK_GATE_TEMPEST_STRESS:-0}
# Set to 1 to run tempest heat slow tests
export DEVSTACK_GATE_TEMPEST_HEAT_SLOW=${DEVSTACK_GATE_TEMPEST_HEAT_SLOW:-0}
# Set to 1 to run tempest large ops test
export DEVSTACK_GATE_TEMPEST_LARGE_OPS=${DEVSTACK_GATE_TEMPEST_LARGE_OPS:-0}
# Set to 1 to run tempest smoke tests serially
export DEVSTACK_GATE_SMOKE_SERIAL=${DEVSTACK_GATE_SMOKE_SERIAL:-0}
# Set to 1 to explicitly enable tempest tenant isolation. Otherwise tenant isolation setting
# for tempest will be the one chosen by devstack.
export DEVSTACK_GATE_TEMPEST_ALLOW_TENANT_ISOLATION=${DEVSTACK_GATE_TEMPEST_ALLOW_TENANT_ISOLATION:-0}
# Set to 1 to enable Cinder secure delete.
# False by default to avoid dd problems on Precise.
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1023755
export DEVSTACK_CINDER_SECURE_DELETE=${DEVSTACK_CINDER_SECURE_DELETE:-0}
# Set to 1 to run neutron instead of nova network
# Only applicable to master branch
export DEVSTACK_GATE_NEUTRON=${DEVSTACK_GATE_NEUTRON:-0}
# Set to 1 to run nova in cells mode instead of the default mode
export DEVSTACK_GATE_CELLS=${DEVSTACK_GATE_CELLS:-0}
# Set to 1 to run ironic baremetal provisioning service.
export DEVSTACK_GATE_IRONIC=${DEVSTACK_GATE_IRONIC:-0}
# Set to 1 to run savanna
export DEVSTACK_GATE_SAVANNA=${DEVSTACK_GATE_SAVANNA:-0}
# Set to 0 to disable config_drive and use the metadata server instead
export DEVSTACK_GATE_CONFIGDRIVE=${DEVSTACK_GATE_CONFIGDRIVE:-1}
# Set the number of threads to run tempest with
export TEMPEST_CONCURRENCY=${TEMPEST_CONCURRENCY:-2}
# The following variables are set for different directions of Grenade updating
# for a stable branch we want to both try to upgrade forward n => n+1 as
# well as upgrade from last n-1 => n.
#
# i.e. stable/havana:
# DGG=1 means stable/grizzly => stable/havana
# DGGF=1 means stable/havana => master (or stable/icehouse if that's out)
export DEVSTACK_GATE_GRENADE=${DEVSTACK_GATE_GRENADE:-0}
export DEVSTACK_GATE_GRENADE_FORWARD=${DEVSTACK_GATE_GRENADE_FORWARD:-0}
function setup_localrc() {
DEFAULT_ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-sch,horizon,mysql,rabbit,sysstat
DEFAULT_ENABLED_SERVICES+=,s-proxy,s-account,s-container,s-object,cinder,c-api,c-vol,c-sch,n-cond
# Allow optional injection of ENABLED_SERVICES from the calling context
if [ -z $ENABLED_SERVICES ] ; then
MY_ENABLED_SERVICES=$DEFAULT_ENABLED_SERVICES
else
MY_ENABLED_SERVICES=$DEFAULT_ENABLED_SERVICES,$ENABLED_SERVICES
fi
if [ "$DEVSTACK_GATE_TEMPEST" -eq "1" ]; then
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,tempest
fi
# the exercises we *don't* want to test on for grenade
SKIP_EXERCISES=boot_from_volume,bundle,client-env,euca
if [ "$LOCALRC_BRANCH" == "stable/grizzly" ]; then
if [ "$DEVSTACK_GATE_NEUTRON" -eq "1" ]; then
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,quantum,q-svc,q-agt,q-dhcp,q-l3,q-meta
echo "Q_USE_DEBUG_COMMAND=True" >>localrc
echo "NETWORK_GATEWAY=10.1.0.1" >>localrc
else
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,n-net
fi
if [ "$DEVSTACK_GATE_CELLS" -eq "1" ]; then
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,n-cell
fi
elif [ "$LOCALRC_BRANCH" == "stable/havana" ]; then
MY_ENABLED_SERVICES+=,c-bak
# we don't want to enable services for grenade that don't have upgrade support
# otherwise they can break grenade, especially when they are projects like
# ceilometer which inject code in other projects
if [ "$DEVSTACK_GATE_GRENADE" -ne "1" ]; then
MY_ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
MY_ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral,ceilometer-collector,ceilometer-api
fi
if [ "$DEVSTACK_GATE_NEUTRON" -eq "1" ]; then
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,quantum,q-svc,q-agt,q-dhcp,q-l3,q-meta,q-lbaas,q-vpn,q-fwaas,q-metering
echo "Q_USE_DEBUG_COMMAND=True" >>localrc
echo "NETWORK_GATEWAY=10.1.0.1" >>localrc
else
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,n-net
fi
if [ "$DEVSTACK_GATE_CELLS" -eq "1" ]; then
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,n-cell
fi
else # master
MY_ENABLED_SERVICES+=,c-bak
# we don't want to enable services for grenade that don't have upgrade support
# otherwise they can break grenade, especially when they are projects like
# ceilometer which inject code in other projects
if [ "$DEVSTACK_GATE_GRENADE" -ne "1" ]; then
MY_ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
MY_ENABLED_SERVICES+=,ceilometer-acompute,ceilometer-acentral,ceilometer-collector,ceilometer-api,ceilometer-alarm-notifier,ceilometer-alarm-evaluator,ceilometer-anotification
fi
if [ "$DEVSTACK_GATE_NEUTRON" -eq "1" ]; then
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,quantum,q-svc,q-agt,q-dhcp,q-l3,q-meta,q-lbaas,q-vpn,q-fwaas,q-metering
echo "Q_USE_DEBUG_COMMAND=True" >>localrc
echo "NETWORK_GATEWAY=10.1.0.1" >>localrc
else
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,n-net
fi
if [ "$DEVSTACK_GATE_CELLS" -eq "1" ]; then
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,n-cell
fi
if [ "$DEVSTACK_GATE_IRONIC" -eq "1" ]; then
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,ir-api,ir-cond
fi
if [ "$DEVSTACK_GATE_SAVANNA" -eq "1" ]; then
MY_ENABLED_SERVICES=$MY_ENABLED_SERVICES,savanna
fi
fi
cat <<EOF >>localrc
DEST=$BASE/$LOCALRC_OLDNEW
ACTIVE_TIMEOUT=90
BOOT_TIMEOUT=90
ASSOCIATE_TIMEOUT=60
TERMINATE_TIMEOUT=60
MYSQL_PASSWORD=secret
DATABASE_PASSWORD=secret
RABBIT_PASSWORD=secret
ADMIN_PASSWORD=secret
SERVICE_PASSWORD=secret
SERVICE_TOKEN=111222333444
SWIFT_HASH=1234123412341234
ROOTSLEEP=0
ERROR_ON_CLONE=True
ENABLED_SERVICES=$MY_ENABLED_SERVICES
SKIP_EXERCISES=$SKIP_EXERCISES
SERVICE_HOST=127.0.0.1
# Screen console logs will capture service logs.
SYSLOG=False
SCREEN_LOGDIR=$BASE/$LOCALRC_OLDNEW/screen-logs
LOGFILE=$BASE/$LOCALRC_OLDNEW/devstacklog.txt
VERBOSE=True
FIXED_RANGE=10.1.0.0/24
FIXED_NETWORK_SIZE=256
VIRT_DRIVER=$DEVSTACK_GATE_VIRT_DRIVER
SWIFT_REPLICAS=1
LOG_COLOR=False
PIP_USE_MIRRORS=False
USE_GET_PIP=1
# Don't reset the requirements.txt files after g-r updates
UNDO_REQUIREMENTS=False
CINDER_PERIODIC_INTERVAL=10
export OS_NO_CACHE=True
EOF
if [ "$DEVSTACK_CINDER_SECURE_DELETE" -eq "0" ]; then
echo "CINDER_SECURE_DELETE=False" >>localrc
fi
if [ "$DEVSTACK_GATE_TEMPEST_HEAT_SLOW" -eq "1" ]; then
echo "HEAT_CREATE_TEST_IMAGE=False" >>localrc
# Use Fedora 20 for heat test image, it has heat-cfntools pre-installed
echo "HEAT_FETCHED_TEST_IMAGE=Fedora-i386-20-20131211.1-sda" >>localrc
fi
if [ "$DEVSTACK_GATE_POSTGRES" -eq "1" ]; then
cat <<\EOF >>localrc
disable_service mysql
enable_service postgresql
EOF
fi
if [ "$DEVSTACK_GATE_MQ_DRIVER" == "zeromq" ]; then
echo "disable_service rabbit" >>localrc
echo "enable_service zeromq" >>localrc
elif [ "$DEVSTACK_GATE_MQ_DRIVER" == "qpid" ]; then
echo "disable_service rabbit" >>localrc
echo "enable_service qpid" >>localrc
fi
if [ "$DEVSTACK_GATE_VIRT_DRIVER" == "openvz" ]; then
echo "SKIP_EXERCISES=${SKIP_EXERCISES},volumes" >>localrc
echo "DEFAULT_INSTANCE_TYPE=m1.small" >>localrc
echo "DEFAULT_INSTANCE_USER=root" >>localrc
echo "DEFAULT_INSTANCE_TYPE=m1.small" >>exerciserc
echo "DEFAULT_INSTANCE_USER=root" >>exerciserc
fi
if [ "$DEVSTACK_GATE_TEMPEST" -eq "1" ]; then
# We need to disable ratelimiting when running
# Tempest tests since so many requests are executed
echo "API_RATE_LIMIT=False" >> localrc
# Volume tests in Tempest require a number of volumes
# to be created, each of 1G size. Devstack's default
# volume backing file size is 10G.
#
# The 24G setting is expected to be enough even
# in parallel run.
echo "VOLUME_BACKING_FILE_SIZE=24G" >> localrc
# in order to ensure glance http tests don't time out, we
# specify the TEMPEST_HTTP_IMAGE address to be horrizon's
# front page. Kind of hacky, but it works.
echo "TEMPEST_HTTP_IMAGE=http://127.0.0.1/" >> localrc
fi
if [ "$DEVSTACK_GATE_TEMPEST_ALLOW_TENANT_ISOLATION" -eq "1" ]; then
echo "TEMPEST_ALLOW_TENANT_ISOLATION=True" >>localrc
fi
if [ "$DEVSTACK_GATE_GRENADE" -eq "1" ]; then
echo "DATA_DIR=/opt/stack/data" >> localrc
echo "SWIFT_DATA_DIR=/opt/stack/data/swift" >> localrc
if [ "$LOCALRC_OLDNEW" == "old" ]; then
echo "GRENADE_PHASE=base" >> localrc
else
echo "GRENADE_PHASE=target" >> localrc
fi
else
# Grenade needs screen, so only turn this off if we aren't
# running grenade.
echo "USE_SCREEN=False" >>localrc
fi
if [ "$DEVSTACK_GATE_TEMPEST_LARGE_OPS" -eq "1" ]; then
# use fake virt driver and 10 copies of nova-compute
echo "VIRT_DRIVER=fake" >> localrc
# To make debugging easier, disabled until bug 1218575 is fixed.
# echo "NUMBER_FAKE_NOVA_COMPUTE=10" >>localrc
echo "TEMPEST_LARGE_OPS_NUMBER=50" >>localrc
fi
if [ "$DEVSTACK_GATE_CONFIGDRIVE" -eq "1" ]; then
echo "FORCE_CONFIG_DRIVE=always" >>localrc
else
echo "FORCE_CONFIG_DRIVE=False" >>localrc
fi
}
function block()
{
if [ "$DEVSTACK_GATE_GRENADE" -eq "1" ]; then
cd $BASE/old/devstack
setup_localrc "old" "$GRENADE_OLD_BRANCH"
cd $BASE/new/devstack
setup_localrc "new" "$GRENADE_OLD_BRANCH"
cat <<EOF >$BASE/new/grenade/localrc
BASE_RELEASE=old
BASE_RELEASE_DIR=$BASE/\$BASE_RELEASE
BASE_DEVSTACK_DIR=\$BASE_RELEASE_DIR/devstack
TARGET_RELEASE=new
TARGET_RELEASE_DIR=$BASE/\$TARGET_RELEASE
TARGET_DEVSTACK_DIR=\$TARGET_RELEASE_DIR/devstack
TARGET_RUN_EXERCISES=False
TARGET_RUN_SMOKE=False
SAVE_DIR=\$BASE_RELEASE_DIR/save
EOF
# Make the workspace owned by the stack user
sudo chown -R stack:stack $BASE
cd $BASE/new/grenade
echo "Running grenade ..."
sudo -H -u stack ./grenade.sh
cd $BASE/new/devstack
else
cd $BASE/new/devstack
setup_localrc "new" "$ZUUL_BRANCH"
# Make the workspace owned by the stack user
sudo chown -R stack:stack $BASE
echo "Running devstack"
# sudo -H -u stack ./stack.sh
# provide a check that the right db was running
# the path are different for fedora and red hat.
if [ -f /usr/bin/yum ]; then
POSTGRES_LOG_PATH="-d /var/lib/pgsql"
MYSQL_LOG_PATH="-f /var/lib/mysqld.log"
else
POSTGRES_LOG_PATH="-d /var/log/postgresql"
MYSQL_LOG_PATH="-d /var/log/mysql"
fi
if [ "$DEVSTACK_GATE_POSTGRES" -eq "1" ]; then
if [ ! $POSTGRES_LOG_PATH ]; then
echo "Postgresql should have been used, but there are no logs"
exit 1
fi
else
if [ ! $MYSQL_LOG_PATH ]; then
echo "Mysql should have been used, but there are no logs"
exit 1
fi
fi
fi
}
setup_localrc
function tempest()
{
echo "Removing sudo privileges for devstack user"
sudo rm /etc/sudoers.d/50_stack_sh
if [ "$DEVSTACK_GATE_EXERCISES" -eq "1" ]; then
echo "Running devstack exercises"
sudo -H -u stack ./exercise.sh
fi
if [ "$DEVSTACK_GATE_TEMPEST" -eq "1" ]; then
if [ ! -f "$BASE/new/tempest/etc/tempest.conf" ]; then
echo "Configuring tempest"
cd $BASE/new/devstack
sudo -H -u stack ./tools/configure_tempest.sh
fi
# under tempest isolation tempest will need to write .tox dir, log files
if [ -d "$BASE/new/tempest" ]; then
sudo chown -R tempest:stack $BASE/new/tempest
fi
# our lock files are in data, so we need to be able to write over there
if [ -d /opt/stack/data/tempest ]; then
sudo chown -R tempest:stack /opt/stack/data/tempest
fi
# ensure the cirros image files are accessible
if [ -d /opt/stack/new/devstack/files ]; then
sudo chmod -R o+rx /opt/stack/new/devstack/files
fi
# let us control if we die or not
set +o errexit
cd $BASE/new/tempest
if [[ "$DEVSTACK_GATE_TEMPEST_ALL" -eq "1" ]]; then
echo "Running tempest all test suite"
sudo -H -u tempest tox -eall -- --concurrency=$TEMPEST_CONCURRENCY
res=$?
elif [[ "$DEVSTACK_GATE_TEMPEST_FULL" -eq "1" ]]; then
echo "Running tempest full test suite"
sudo -H -u tempest tox -efull -- --concurrency=$TEMPEST_CONCURRENCY
res=$?
elif [[ "$DEVSTACK_GATE_TEMPEST_TESTR_FULL" -eq "1" ]]; then
echo "Running tempest full test suite with testr"
sudo -H -u tempest tox -etestr-full -- --concurrency=$TEMPEST_CONCURRENCY
res=$?
elif [[ "$DEVSTACK_GATE_TEMPEST_STRESS" -eq "1" ]] ; then
echo "Running stress tests"
sudo -H -u tempest tox -estress
res=$?
elif [[ "$DEVSTACK_GATE_TEMPEST_HEAT_SLOW" -eq "1" ]] ; then
echo "Running slow heat tests"
sudo -H -u tempest tox -eheat-slow -- --concurrency=$TEMPEST_CONCURRENCY
res=$?
elif [[ "$DEVSTACK_GATE_TEMPEST_LARGE_OPS" -eq "1" ]] ; then
echo "Running large ops tests"
sudo -H -u tempest tox -elarge-ops -- --concurrency=$TEMPEST_CONCURRENCY
res=$?
elif [[ "$DEVSTACK_GATE_SMOKE_SERIAL" -eq "1" ]] ; then
echo "Running tempest smoke tests"
sudo -H -u tempest tox -esmoke-serial
res=$?
else
echo "Running tempest smoke tests"
sudo -H -u tempest tox -esmoke -- --concurrency=$TEMPEST_CONCURRENCY
res=$?
fi
if [[ "$GRENADE_OLD_BRANCH" != "stable/grizzly" ]] && \
[[ "$DEVSTACK_GATE_TEMPEST_STRESS" -ne "1" ]] ; then
tools/check_logs.py -d $BASE/new/screen-logs
res2=$?
fi
# TODO(sdague): post icehouse-2 we can talk about turning
# this back on, but right now it is violating the do no harm
# principle.
# [[ $res -eq 0 && $res2 -eq 0 ]]
# exit $?
exit $res
else
# Jenkins expects at least one nosetests file. If we're not running
# tempest, then write a fake one that indicates the tests pass (since
# we made it past exercise.sh.
cat > $WORKSPACE/nosetests-fake.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?><testsuite name="nosetests" tests="0" errors="0" failures="0" skip="0"></testsuite>
EOF
fi
}