blob: a443ac82d057c397d1bae87588933cfa89cae2ba [file] [log] [blame]
Dean Troyer995eb922013-03-07 16:11:40 -06001#!/usr/bin/env bash
2
3# **clean.sh**
4
5# ``clean.sh`` does its best to eradicate traces of a Grenade
6# run except for the following:
7# - both base and target code repos are left alone
8# - packages (system and pip) are left alone
9
10# This means that all data files are removed. More??
11
12# Keep track of the current devstack directory.
13TOP_DIR=$(cd $(dirname "$0") && pwd)
14
15# Import common functions
16source $TOP_DIR/functions
17
18# Load local configuration
19source $TOP_DIR/stackrc
20
21# Get the variables that are set in stack.sh
Dean Troyer58f9cf72013-06-04 12:51:54 -050022if [[ -r $TOP_DIR/.stackenv ]]; then
23 source $TOP_DIR/.stackenv
24fi
Dean Troyer995eb922013-03-07 16:11:40 -060025
26# Determine what system we are running on. This provides ``os_VENDOR``,
27# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
28# and ``DISTRO``
29GetDistro
30
31
32# Import database library
33source $TOP_DIR/lib/database
34source $TOP_DIR/lib/rpc_backend
35
36source $TOP_DIR/lib/tls
37source $TOP_DIR/lib/horizon
38source $TOP_DIR/lib/keystone
39source $TOP_DIR/lib/glance
40source $TOP_DIR/lib/nova
41source $TOP_DIR/lib/cinder
42source $TOP_DIR/lib/swift
43source $TOP_DIR/lib/ceilometer
44source $TOP_DIR/lib/heat
Mark McClainb05c8762013-07-06 23:29:39 -040045source $TOP_DIR/lib/neutron
Dean Troyer995eb922013-03-07 16:11:40 -060046source $TOP_DIR/lib/baremetal
47source $TOP_DIR/lib/ldap
48
49
50# See if there is anything running...
51# need to adapt when run_service is merged
52SESSION=$(screen -ls | awk '/[0-9].stack/ { print $1 }')
53if [[ -n "$SESSION" ]]; then
54 # Let unstack.sh do its thing first
55 $TOP_DIR/unstack.sh --all
56fi
57
58# Clean projects
Sean Daguedb5fadb2013-08-09 13:41:33 -040059cleanup_oslo
Dean Troyer995eb922013-03-07 16:11:40 -060060cleanup_cinder
61cleanup_glance
62cleanup_keystone
63cleanup_nova
Mark McClainb05c8762013-07-06 23:29:39 -040064cleanup_neutron
Dean Troyer995eb922013-03-07 16:11:40 -060065cleanup_swift
66
Dean Troyer2aa2a892013-08-04 19:53:19 -050067# Do the hypervisor cleanup until this can be moved back into lib/nova
68if [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
69 cleanup_nova_hypervisor
70fi
71
JordanP51c90b82013-05-23 10:27:51 +020072# cinder doesn't always clean up the volume group as it might be used elsewhere...
Dean Troyer995eb922013-03-07 16:11:40 -060073# clean it up if it is a loop device
74VG_DEV=$(sudo losetup -j $DATA_DIR/${VOLUME_GROUP}-backing-file | awk -F':' '/backing-file/ { print $1}')
75if [[ -n "$VG_DEV" ]]; then
76 sudo losetup -d $VG_DEV
77fi
78
79#if mount | grep $DATA_DIR/swift/drives; then
80# sudo umount $DATA_DIR/swift/drives/sdb1
81#fi
82
83
84# Clean out /etc
85sudo rm -rf /etc/keystone /etc/glance /etc/nova /etc/cinder /etc/swift
86
87# Clean out tgt
88sudo rm /etc/tgt/conf.d/*
89
90# Clean up the message queue
91cleanup_rpc_backend
92cleanup_database
93
94# Clean up networking...
95# should this be in nova?
96# FIXED_IP_ADDR in br100
97
98# Clean up files
Dean Troyer58f9cf72013-06-04 12:51:54 -050099rm -f $TOP_DIR/.stackenv