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@redhat.com --- kdumpctl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
diff --git a/kdumpctl b/kdumpctl index 8c40564..fb4112e 100755 --- a/kdumpctl +++ b/kdumpctl @@ -171,6 +171,45 @@ check_kdump_cpus() echo " try nr_cpus=$nr_min or larger instead" }
+GENERATED_LVM_CMDLINES="" +# Generate rd.lvm.lv=X for the kdump targets if any. +generate_lvm_cmdline() +{ + local majmin=$1 dev + + [ -d "/sys/dev/block/$majmin/dm" ] || return 0 + dev=/dev/mapper/$(< "/sys/dev/block/$majmin/dm/name") + + 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 + GENERATED_LVM_CMDLINES="rd.lvm.lv=$vg/$lv $GENERATED_LVM_CMDLINES" + fi + + return 0 +} + +generate_lvm_cmdlines() +{ + for_each_block_target_all generate_lvm_cmdline + + echo "$GENERATED_LVM_CMDLINES" +} + +# $1: function name +for_each_block_target_all() +{ + local dev majmin + + for dev in $(get_kdump_targets); do + [ -b "$dev" ] || continue + majmin=$(get_maj_min $dev) + check_block_and_slaves_all $1 $majmin + done + + return 0 +} + # This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -199,6 +238,12 @@ prepare_cmdline() cmdline=`remove_cmdline_param "$cmdline" root` fi
+ # Remove all the inherited rd.lvm.lv=X and generate those as needed. + if [ $DEFAULT_DUMP_MODE != "fadump" ]; then + cmdline=`remove_cmdline_param "$cmdline" rd.lvm.lv` + cmdline="${cmdline} $(generate_lvm_cmdlines)" + fi + cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
id=`get_bootcpu_initial_apicid`