summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2014-12-10 13:25:23 +0100
committerPeter Rajnoha <prajnoha@redhat.com>2014-12-10 13:59:38 +0100
commit00b36ef06acb15c82d7c9b37872753f02c638316 (patch)
tree62d14c1039de63d647e22c09a9db961b4d4b5dfe
parent5378a1a63e8a8d89cca9460051d473b7547404f9 (diff)
downloadlvm2-00b36ef06acb15c82d7c9b37872753f02c638316.tar.gz
vgimportclone: replace awk with dumpconfig to generate temporary lvm.conf for vgimportclone
With current dumpconfig, we can generate lvm.conf easily - we can merge current lvm.conf with the config given on cmd line: lvm dumpconfig --mergedconfig --config "..." This is a bit simpler than using awk and it also avoids problems when some of the configuration is missing in existing lvm.conf file and hardcoded defaults are used instead. The dumpconfig handles this transparently.
-rw-r--r--WHATS_NEW1
-rwxr-xr-xscripts/vgimportclone.sh22
2 files changed, 12 insertions, 11 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 9201f3682..72d3b6a05 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.115 -
=====================================
+ Fix vgimportclone to properly override config if it is missing in lvm.conf.
Fix automatic use of configure --enable-udev-systemd-background-jobs.
Correctly rename active split LV with -splitmirrors for raid1.
Add report/compact_output to lvm.conf to enable/disable compact report output.
diff --git a/scripts/vgimportclone.sh b/scripts/vgimportclone.sh
index 708755792..bfff13110 100755
--- a/scripts/vgimportclone.sh
+++ b/scripts/vgimportclone.sh
@@ -242,17 +242,17 @@ export FILTER="filter=[ ${FILTER} \"r|.*|\" ]"
LVMCONF=${TMP_LVM_SYSTEM_DIR}/lvm.conf
-# FIXME convert to cmdline override
-"$LVM" dumpconfig ${LVM_OPTS} | \
-"$AWK" -v DEV=${TMP_LVM_SYSTEM_DIR} -v CACHE=${TMP_LVM_SYSTEM_DIR}/.cache \
- -v CACHE_DIR=${TMP_LVM_SYSTEM_DIR}/cache \
- '/^[ \t]*filter[ \t]*=/{print ENVIRON["FILTER"];next} \
- /^[ \t]*scan[ \t]*=/{print "scan = [ \"" DEV "\" ]";next} \
- /^[ \t]*cache[ \t]*=/{print "cache = \"" CACHE "\"";next} \
- /^[ \t]*use_lvmetad[ \t]*=/{print "use_lvmetad = 0";next} \
- /^[ \t]*global_filter[ \t]*=/{print "global_filter = [ \"a|.*|\" ]";next} \
- /^[ \t]*cache_dir[ \t]*=/{print "cache_dir = \"" CACHE_DIR "\"";next} \
- {print $0}' > ${LVMCONF}
+CMD_CONFIG_LINE="devices { \
+ scan = [ \"${TMP_LVM_SYSTEM_DIR}\" ] \
+ cache_dir = \"$TMP_LVM_SYSTEM_DIR}/cache\"
+ global_filter = [ \"a|.*|\" ] \
+ ${FILTER}
+ } \
+ global { \
+ use_lvmetad = 0 \
+ }"
+
+$LVM dumpconfig ${LVM_OPTS} --file ${LVMCONF} --mergedconfig --config "${CMD_CONFIG_LINE}"
checkvalue $? "Failed to generate ${LVMCONF}"
# Only keep TMP_LVM_SYSTEM_DIR if it contains something worth keeping