Resolves: bz1451717
https://bugzilla.redhat.com/1451717
When there is any "rd.lvm.lv=X", "lvm" dracut module will
try to recognize all the lvm volumes which is unnecessary
and probably cause trouble for us.
See
https://bugzilla.redhat.com/show_bug.cgi?id=1451717#c2
Remove all the rd.lvm.lv=X inherited from the kernel cmdline,
and generate the corresponding cmdline as needed.
Currently, we don't handle "rd.lvm.vg=X", we can add it in
when there is some bug reported in the future.
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
kdumpctl | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 221b461..7cbef2e 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -176,6 +176,42 @@ is_dump_to_rootfs()
grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null
}
+# Generate rd.lvm.lv=X for the kdump targets if any.
+generate_lvm_cmdline()
+{
+ local dev=$1
+ local vg lv cmdline dir_s dev_s
+
+ ! [ -b $dev ] && return
+
+ vg=$(lvm lvs --rows $dev -o vg_name --separator=* 2>/dev/null | cut -d "*"
-f 2)
+ lv=$(lvm lvs --rows $dev -o lv_name --separator=* 2>/dev/null | cut -d "*"
-f 2)
+ if [ -n "$vg" -a -n "$lv" ]; then
+ cmdline="rd.lvm.lv=$vg/$lv"
+ fi
+
+ dev=$(get_maj_min $dev)
+ [[ -d /sys/dev/block/$dev/slaves ]] || return
+ for dir_s in /sys/dev/block/$dev/slaves/*; do
+ dev_s=$(< "$dir_s/dev")
+ dev_s=$(get_persistent_dev dev_s)
+ cmdline="$cmdline $(generate_lvm_cmdline $dev_s)"
+ done
+
+ [ -n "$cmdline" ] && echo "$cmdline"
+}
+
+generate_lvm_cmdlines()
+{
+ local target cmdlines
+
+ for target in "$KDUMP_TARGETS"; do
+ cmdlines="$cmdlines $(generate_lvm_cmdline $target)"
+ done
+
+ [ -n "$cmdlines" ] && echo "$cmdlines"
+}
+
# This function performs a series of edits on the command line.
# Store the final result in global $KDUMP_COMMANDLINE.
prepare_cmdline()
@@ -204,6 +240,10 @@ prepare_cmdline()
cmdline=`remove_cmdline_param "$cmdline" root`
fi
+ # Remove all the inherited rd.lvm.lv=X and generate those as needed.
+ cmdline=`remove_cmdline_param "$cmdline" rd.lvm.lv`
+ cmdline="${cmdline} $(generate_lvm_cmdlines)"
+
cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
id=`get_bootcpu_initial_apicid`
--
1.8.3.1