Browse code

clean.sh updates

* Clean out data, log and state dirs
* Include lib/apache to clear is_apache_enabled_service not found error
* Clean errors removing tgt config files

* Clean errors removing VG backing file in lib/cinder

Change-Id: I33dfde17eb8daaaed7f7e76337fe6a8085a266bf

Dean Troyer authored on 2013/12/18 02:13:40
Showing 2 changed files
... ...
@@ -30,13 +30,17 @@ fi
30 30
 # and ``DISTRO``
31 31
 GetDistro
32 32
 
33
+# Import apache functions
34
+source $TOP_DIR/lib/apache
35
+source $TOP_DIR/lib/ldap
33 36
 
34 37
 # Import database library
35 38
 source $TOP_DIR/lib/database
36 39
 source $TOP_DIR/lib/rpc_backend
37 40
 
38
-source $TOP_DIR/lib/oslo
39 41
 source $TOP_DIR/lib/tls
42
+
43
+source $TOP_DIR/lib/oslo
40 44
 source $TOP_DIR/lib/horizon
41 45
 source $TOP_DIR/lib/keystone
42 46
 source $TOP_DIR/lib/glance
... ...
@@ -47,7 +51,9 @@ source $TOP_DIR/lib/ceilometer
47 47
 source $TOP_DIR/lib/heat
48 48
 source $TOP_DIR/lib/neutron
49 49
 source $TOP_DIR/lib/baremetal
50
-source $TOP_DIR/lib/ldap
50
+source $TOP_DIR/lib/ironic
51
+source $TOP_DIR/lib/trove
52
+
51 53
 
52 54
 # Extras Source
53 55
 # --------------
... ...
@@ -95,13 +101,6 @@ if [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
95 95
     cleanup_nova_hypervisor
96 96
 fi
97 97
 
98
-# cinder doesn't always clean up the volume group as it might be used elsewhere...
99
-# clean it up if it is a loop device
100
-VG_DEV=$(sudo losetup -j $DATA_DIR/${VOLUME_GROUP}-backing-file | awk -F':' '/backing-file/ { print $1}')
101
-if [[ -n "$VG_DEV" ]]; then
102
-    sudo losetup -d $VG_DEV
103
-fi
104
-
105 98
 #if mount | grep $DATA_DIR/swift/drives; then
106 99
 #  sudo umount $DATA_DIR/swift/drives/sdb1
107 100
 #fi
... ...
@@ -111,12 +110,19 @@ fi
111 111
 sudo rm -rf /etc/keystone /etc/glance /etc/nova /etc/cinder /etc/swift
112 112
 
113 113
 # Clean out tgt
114
-sudo rm /etc/tgt/conf.d/*
114
+sudo rm -f /etc/tgt/conf.d/*
115 115
 
116 116
 # Clean up the message queue
117 117
 cleanup_rpc_backend
118 118
 cleanup_database
119 119
 
120
+# Clean out data, logs and status
121
+LOGDIR=$(dirname "$LOGFILE")
122
+sudo rm -rf $DATA_DIR $LOGDIR $DEST/status
123
+if [[ -n "$SCREEN_LOGDIR" ]] && [[ -d "$SCREEN_LOGDIR" ]]; then
124
+    sudo rm -rf $SCREEN_LOGDIR
125
+fi
126
+
120 127
 # Clean up networking...
121 128
 # should this be in nova?
122 129
 # FIXED_IP_ADDR in br100
... ...
@@ -109,8 +109,8 @@ function _clean_lvm_backing_file() {
109 109
     # of the backing file
110 110
     if [ -z "`sudo lvs --noheadings -o lv_name $vg`" ]; then
111 111
         # if the backing physical device is a loop device, it was probably setup by devstack
112
-        VG_DEV=$(sudo losetup -j $DATA_DIR/${vg}-backing-file | awk -F':' '/backing-file/ { print $1}')
113
-        if [[ -n "$VG_DEV" ]]; then
112
+        if [[ -n "$VG_DEV" ]] && [[ -e "$VG_DEV" ]]; then
113
+            VG_DEV=$(sudo losetup -j $DATA_DIR/${vg}-backing-file | awk -F':' '/backing-file/ { print $1}')
114 114
             sudo losetup -d $VG_DEV
115 115
             rm -f $DATA_DIR/${vg}-backing-file
116 116
         fi