Skip to content

Commit 9a413ab

Browse files
committed
add gating up/down script for devstack
This adds the test infrastructure for testing that unstack.sh and clean.sh do the right thing, and actually stop what's expected. This is designed to be used in upstream testing to make unstack and clean a bit more certain. It includes numerous fixes to make these pass in an errexit environment with the gate config. The scripts still don't run under errexit because we don't assume we've handled all possible cleanup safely. Change-Id: I774dfb2cc934367eef2bb7ea5123197f6da7565b
1 parent fdae448 commit 9a413ab

7 files changed

Lines changed: 44 additions & 12 deletions

File tree

clean.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22

33
# **clean.sh**
44

@@ -83,7 +83,10 @@ if [[ -d $TOP_DIR/extras.d ]]; then
8383
fi
8484

8585
# Clean projects
86-
cleanup_cinder
86+
87+
# BUG: cinder tgt doesn't exit cleanly if it's not running.
88+
cleanup_cinder || /bin/true
89+
8790
cleanup_glance
8891
cleanup_keystone
8992
cleanup_nova

gate/updown.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash -xe
2+
#
3+
# An up / down test for gate functional testing
4+
#
5+
# Note: this is expected to start running as jenkins
6+
7+
# Step 1: give back sudoers permissions to devstack
8+
TEMPFILE=`mktemp`
9+
echo "stack ALL=(root) NOPASSWD:ALL" >$TEMPFILE
10+
chmod 0440 $TEMPFILE
11+
sudo chown root:root $TEMPFILE
12+
sudo mv $TEMPFILE /etc/sudoers.d/51_stack_sh
13+
14+
# TODO: do something to start a guest to create crud that should
15+
# disappear
16+
17+
# Step 2: unstack
18+
echo "Running unstack.sh"
19+
sudo -H -u stack stdbuf -oL -eL bash -ex ./unstack.sh
20+
21+
# Step 3: clean
22+
echo "Running clean.sh"
23+
sudo -H -u stack stdbuf -oL -eL bash -ex ./clean.sh
24+

lib/databases/mysql

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,14 @@ function cleanup_database_mysql {
2828
stop_service $MYSQL
2929
if is_ubuntu; then
3030
# Get ruthless with mysql
31-
stop_service $MYSQL
3231
apt_get purge -y mysql* mariadb*
3332
sudo rm -rf /var/lib/mysql
3433
sudo rm -rf /etc/mysql
3534
return
3635
elif is_fedora; then
37-
stop_service mariadb
3836
uninstall_package mariadb-server
3937
sudo rm -rf /var/lib/mysql
4038
elif is_suse; then
41-
stop_service mysql
4239
uninstall_package mysql-community-server
4340
sudo rm -rf /var/lib/mysql
4441
else

lib/dstat

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ function start_dstat {
4040

4141
# stop_dstat() stop dstat process
4242
function stop_dstat {
43-
screen_stop dstat
43+
# dstat runs as a console, not as a service, and isn't trackable
44+
# via the normal mechanisms for devstack. So lets just do a
45+
# killall and move on.
46+
killall dstat || /bin/true
4447
}
4548

4649
# Restore xtrace

lib/rpc_backend

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ function cleanup_rpc_backend {
7474
if is_service_enabled rabbit; then
7575
# Obliterate rabbitmq-server
7676
uninstall_package rabbitmq-server
77-
sudo killall epmd || sudo killall -9 epmd
77+
# in case it's not actually running, /bin/true at the end
78+
sudo killall epmd || sudo killall -9 epmd || /bin/true
7879
if is_ubuntu; then
7980
# And the Erlang runtime too
8081
apt_get purge -y erlang*

lib/sahara

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function start_sahara {
184184
# stop_sahara() - Stop running processes
185185
function stop_sahara {
186186
# Kill the Sahara screen windows
187-
screen -S $SCREEN_NAME -p sahara -X kill
187+
stop_process sahara
188188
}
189189

190190

unstack.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
22

33
# **unstack.sh**
44

@@ -136,10 +136,13 @@ fi
136136

137137
SCSI_PERSIST_DIR=$CINDER_STATE_PATH/volumes/*
138138

139+
# BUG: tgt likes to exit 1 on service stop if everything isn't
140+
# perfect, we should clean up cinder stop paths.
141+
139142
# Get the iSCSI volumes
140143
if is_service_enabled cinder; then
141-
stop_cinder
142-
cleanup_cinder
144+
stop_cinder || /bin/true
145+
cleanup_cinder || /bin/true
143146
fi
144147

145148
if [[ -n "$UNSTACK_ALL" ]]; then
@@ -179,4 +182,5 @@ if [[ -n "$SCREEN" ]]; then
179182
fi
180183
fi
181184

182-
clean_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME
185+
# BUG: maybe it doesn't exist? We should isolate this further down.
186+
clean_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME || /bin/true

0 commit comments

Comments
 (0)