blob: ffc462c6f3087361a5976723c8f27e582df6ee5d [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
45source $TOP_DIR/lib/quantum
46source $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
59cleanup_cinder
60cleanup_glance
61cleanup_keystone
62cleanup_nova
63cleanup_quantum
64cleanup_swift
65
66# cinder doesn't clean up the volume group as it might be used elsewhere...
67# clean it up if it is a loop device
68VG_DEV=$(sudo losetup -j $DATA_DIR/${VOLUME_GROUP}-backing-file | awk -F':' '/backing-file/ { print $1}')
69if [[ -n "$VG_DEV" ]]; then
70 sudo losetup -d $VG_DEV
71fi
72
73#if mount | grep $DATA_DIR/swift/drives; then
74# sudo umount $DATA_DIR/swift/drives/sdb1
75#fi
76
77
78# Clean out /etc
79sudo rm -rf /etc/keystone /etc/glance /etc/nova /etc/cinder /etc/swift
80
81# Clean out tgt
82sudo rm /etc/tgt/conf.d/*
83
84# Clean up the message queue
85cleanup_rpc_backend
86cleanup_database
87
88# Clean up networking...
89# should this be in nova?
90# FIXED_IP_ADDR in br100
91
92# Clean up files
Dean Troyer58f9cf72013-06-04 12:51:54 -050093rm -f $TOP_DIR/.stackenv