blob: cf24f278b8c007fbfaaa77f746fd9bb8fa2dfaa9 [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
22source $TOP_DIR/.stackenv
23
24# Determine what system we are running on. This provides ``os_VENDOR``,
25# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
26# and ``DISTRO``
27GetDistro
28
29
30# Import database library
31source $TOP_DIR/lib/database
32source $TOP_DIR/lib/rpc_backend
33
34source $TOP_DIR/lib/tls
35source $TOP_DIR/lib/horizon
36source $TOP_DIR/lib/keystone
37source $TOP_DIR/lib/glance
38source $TOP_DIR/lib/nova
39source $TOP_DIR/lib/cinder
40source $TOP_DIR/lib/swift
41source $TOP_DIR/lib/ceilometer
42source $TOP_DIR/lib/heat
43source $TOP_DIR/lib/quantum
44source $TOP_DIR/lib/baremetal
45source $TOP_DIR/lib/ldap
46
47
48# See if there is anything running...
49# need to adapt when run_service is merged
50SESSION=$(screen -ls | awk '/[0-9].stack/ { print $1 }')
51if [[ -n "$SESSION" ]]; then
52 # Let unstack.sh do its thing first
53 $TOP_DIR/unstack.sh --all
54fi
55
56# Clean projects
57cleanup_cinder
58cleanup_glance
59cleanup_keystone
60cleanup_nova
61cleanup_quantum
62cleanup_swift
63
64# cinder doesn't clean up the volume group as it might be used elsewhere...
65# clean it up if it is a loop device
66VG_DEV=$(sudo losetup -j $DATA_DIR/${VOLUME_GROUP}-backing-file | awk -F':' '/backing-file/ { print $1}')
67if [[ -n "$VG_DEV" ]]; then
68 sudo losetup -d $VG_DEV
69fi
70
71#if mount | grep $DATA_DIR/swift/drives; then
72# sudo umount $DATA_DIR/swift/drives/sdb1
73#fi
74
75
76# Clean out /etc
77sudo rm -rf /etc/keystone /etc/glance /etc/nova /etc/cinder /etc/swift
78
79# Clean out tgt
80sudo rm /etc/tgt/conf.d/*
81
82# Clean up the message queue
83cleanup_rpc_backend
84cleanup_database
85
86# Clean up networking...
87# should this be in nova?
88# FIXED_IP_ADDR in br100
89
90# Clean up files
91#rm -f .stackenv