forked from openstack/devstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clean.sh
executable file
·131 lines (101 loc) · 2.83 KB
/
clean.sh
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
#!/usr/bin/env bash
# **clean.sh**
# ``clean.sh`` does its best to eradicate traces of a Grenade
# run except for the following:
# - both base and target code repos are left alone
# - packages (system and pip) are left alone
# This means that all data files are removed. More??
# Keep track of the current devstack directory.
TOP_DIR=$(cd $(dirname "$0") && pwd)
# Import common functions
source $TOP_DIR/functions
FILES=$TOP_DIR/files
# Load local configuration
source $TOP_DIR/stackrc
# Get the variables that are set in stack.sh
if [[ -r $TOP_DIR/.stackenv ]]; then
source $TOP_DIR/.stackenv
fi
# Determine what system we are running on. This provides ``os_VENDOR``,
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
# and ``DISTRO``
GetDistro
# Import apache functions
source $TOP_DIR/lib/apache
source $TOP_DIR/lib/ldap
# Import database library
source $TOP_DIR/lib/database
source $TOP_DIR/lib/rpc_backend
source $TOP_DIR/lib/tls
source $TOP_DIR/lib/oslo
source $TOP_DIR/lib/horizon
source $TOP_DIR/lib/keystone
source $TOP_DIR/lib/glance
source $TOP_DIR/lib/nova
source $TOP_DIR/lib/cinder
source $TOP_DIR/lib/swift
source $TOP_DIR/lib/ceilometer
source $TOP_DIR/lib/heat
source $TOP_DIR/lib/neutron
source $TOP_DIR/lib/baremetal
source $TOP_DIR/lib/ironic
source $TOP_DIR/lib/trove
# Extras Source
# --------------
# Phase: source
if [[ -d $TOP_DIR/extras.d ]]; then
for i in $TOP_DIR/extras.d/*.sh; do
[[ -r $i ]] && source $i source
done
fi
# See if there is anything running...
# need to adapt when run_service is merged
SESSION=$(screen -ls | awk '/[0-9].stack/ { print $1 }')
if [[ -n "$SESSION" ]]; then
# Let unstack.sh do its thing first
$TOP_DIR/unstack.sh --all
fi
# Run extras
# ==========
# Phase: clean
if [[ -d $TOP_DIR/extras.d ]]; then
for i in $TOP_DIR/extras.d/*.sh; do
[[ -r $i ]] && source $i clean
done
fi
# Clean projects
cleanup_oslo
cleanup_cinder
cleanup_glance
cleanup_keystone
cleanup_nova
cleanup_neutron
cleanup_swift
if is_service_enabled ldap; then
cleanup_ldap
fi
# Do the hypervisor cleanup until this can be moved back into lib/nova
if is_service_enabled nova && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
cleanup_nova_hypervisor
fi
#if mount | grep $DATA_DIR/swift/drives; then
# sudo umount $DATA_DIR/swift/drives/sdb1
#fi
# Clean out /etc
sudo rm -rf /etc/keystone /etc/glance /etc/nova /etc/cinder /etc/swift
# Clean out tgt
sudo rm -f /etc/tgt/conf.d/*
# Clean up the message queue
cleanup_rpc_backend
cleanup_database
# Clean out data, logs and status
LOGDIR=$(dirname "$LOGFILE")
sudo rm -rf $DATA_DIR $LOGDIR $DEST/status
if [[ -n "$SCREEN_LOGDIR" ]] && [[ -d "$SCREEN_LOGDIR" ]]; then
sudo rm -rf $SCREEN_LOGDIR
fi
# Clean up networking...
# should this be in nova?
# FIXED_IP_ADDR in br100
# Clean up files
rm -f $TOP_DIR/.stackenv