From 6cdb2e0f1a2c2429587f1e9187344cb26eb31812 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Thu, 23 Apr 2015 09:12:59 -0700 Subject: [PATCH] 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 --- lib/cinder_backends/lvm | 1 + lib/lvm | 10 +++++++++- unstack.sh | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/cinder_backends/lvm b/lib/cinder_backends/lvm index d369c0c840..35ad209db7 100644 --- a/lib/cinder_backends/lvm +++ b/lib/cinder_backends/lvm @@ -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 diff --git a/lib/lvm b/lib/lvm index 54976a36cd..1fe2683e65 100644 --- a/lib/lvm +++ b/lib/lvm @@ -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" } diff --git a/unstack.sh b/unstack.sh index 30981fd3c6..ed7e6175ca 100755 --- a/unstack.sh +++ b/unstack.sh @@ -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