Browse code

Remove the lvm.conf filter during cleanup

This avoids us leaving the filter in the global lvm config. Without cleaning
this up, we can hit some failures to run stack.sh because devices are excluded
that we need to be able to see. This resets it to what it was before when
we do a cleanup.

Also, do this before we add the line, so we don't add multiple lines on
successive runs.

Closes-bug: #1437998
Change-Id: Idbf8a06b723f79ef16a7c175ee77a8c25f813244

Dan Smith authored on 2015/04/24 01:12:59
Showing 3 changed files
... ...
@@ -39,6 +39,7 @@ function cleanup_cinder_backend_lvm {
39 39
 
40 40
     # Campsite rule: leave behind a volume group at least as clean as we found it
41 41
     clean_lvm_volume_group $VOLUME_GROUP_NAME-$be_name
42
+    clean_lvm_filter
42 43
 }
43 44
 
44 45
 # configure_cinder_backend_lvm - Set config files, create data dirs, etc
... ...
@@ -145,6 +145,13 @@ function init_default_lvm_volume_group {
145 145
     fi
146 146
 }
147 147
 
148
+# clean_lvm_filter() Remove the filter rule set in set_lvm_filter()
149
+#
150
+# Usage: clean_lvm_filter()
151
+function clean_lvm_filter {
152
+    sudo sed -i "s/^.*# from devstack$//" /etc/lvm/lvm.conf
153
+}
154
+
148 155
 # set_lvm_filter() Gather all devices configured for LVM and
149 156
 # use them to build a global device filter
150 157
 # set_lvm_filter() Create a device filter
... ...
@@ -154,7 +161,7 @@ function init_default_lvm_volume_group {
154 154
 #
155 155
 # Usage: set_lvm_filter()
156 156
 function set_lvm_filter {
157
-    local filter_suffix='"r|.*|" ]'
157
+    local filter_suffix='"r|.*|" ]  # from devstack'
158 158
     local filter_string="global_filter = [ "
159 159
     local pv
160 160
     local vg
... ...
@@ -167,6 +174,7 @@ function set_lvm_filter {
167 167
     done
168 168
     filter_string=$filter_string$filter_suffix
169 169
 
170
+    clean_lvm_filter
170 171
     sudo sed -i "/# global_filter = \[*\]/a\    $global_filter$filter_string" /etc/lvm/lvm.conf
171 172
     echo_summary "set lvm.conf device global_filter to: $filter_string"
172 173
 }
... ...
@@ -192,3 +192,4 @@ fi
192 192
 
193 193
 # BUG: maybe it doesn't exist? We should isolate this further down.
194 194
 clean_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME || /bin/true
195
+clean_lvm_filter