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
diff --git a/lib/lvm b/lib/lvm
index 54976a3..1fe2683 100644
--- a/lib/lvm
+++ b/lib/lvm
@@ -145,6 +145,13 @@
fi
}
+# clean_lvm_filter() Remove the filter rule set in set_lvm_filter()
+#
+# Usage: clean_lvm_filter()
+function clean_lvm_filter {
+ sudo sed -i "s/^.*# from devstack$//" /etc/lvm/lvm.conf
+}
+
# set_lvm_filter() Gather all devices configured for LVM and
# use them to build a global device filter
# set_lvm_filter() Create a device filter
@@ -154,7 +161,7 @@
#
# Usage: set_lvm_filter()
function set_lvm_filter {
- local filter_suffix='"r|.*|" ]'
+ local filter_suffix='"r|.*|" ] # from devstack'
local filter_string="global_filter = [ "
local pv
local vg
@@ -167,6 +174,7 @@
done
filter_string=$filter_string$filter_suffix
+ clean_lvm_filter
sudo sed -i "/# global_filter = \[*\]/a\ $global_filter$filter_string" /etc/lvm/lvm.conf
echo_summary "set lvm.conf device global_filter to: $filter_string"
}