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
(cherry picked from commit 6cdb2e0f1a)
This commit is contained in:
Dan Smith 2015-04-23 09:12:59 -07:00
parent 6e28894b47
commit 2d4ea363ae
3 changed files with 11 additions and 1 deletions

View File

@ -39,6 +39,7 @@ function cleanup_cinder_backend_lvm {
# Campsite rule: leave behind a volume group at least as clean as we found it
clean_lvm_volume_group $VOLUME_GROUP_NAME-$be_name
clean_lvm_filter
}
# configure_cinder_backend_lvm - Set config files, create data dirs, etc

10
lib/lvm
View File

@ -145,6 +145,13 @@ function init_default_lvm_volume_group {
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 @@ function init_default_lvm_volume_group {
#
# 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 @@ function set_lvm_filter {
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"
}

View File

@ -192,3 +192,4 @@ fi
# BUG: maybe it doesn't exist? We should isolate this further down.
clean_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME || /bin/true
clean_lvm_filter