On 03/27/17 at 10:42am, Xunlei Pang wrote:
We can easily achieve this by adding a "any_lvm" job in
the
KDUMP_TARGET_CHECKLIST.
We need this, because for example in case of "nfs"(and root
device is not a lvm volmue) dumping, if "lvm" module is added,
"lvm2" tool under kdump still operates the lvm volume due to
the "rd.lvm.lv=X" inherited from the first kernel if any.
This patch removes "lvm" and all the related cmdline from the
kdump/initramfs in case of no lvm target, it can reduce several
megabytes from initramfs.
Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
---
kdumpctl | 15 ++++++++++++++-
mkdumprd | 5 +++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/kdumpctl b/kdumpctl
index 1cb6f36..8a0c400 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -27,7 +27,7 @@ image_time=0
# implement its logic to update its tag value in the tag inventory.
# Then "kdump_targets_tell xxx" will be available for you to use.
# See kdump_target_handle_item() for examples.
-KDUMP_TARGET_CHECKLIST="all_root"
+KDUMP_TARGET_CHECKLIST="all_root any_lvm"
standard_kexec_args="-p"
@@ -216,6 +216,11 @@ prepare_cmdline()
cmdline=`remove_cmdline_param "$cmdline" root`
fi
+ # Remove all the lvm related cmdlines to avoid confusion if no lvm targets
+ if ! kdump_targets_tell any_lvm; then
+ cmdline=`remove_cmdline_param "$cmdline" rd.lvm.lv rd_LVM_LV rd.lvm.vg
rd_LVM_VG`
+ fi
+
KDUMP_COMMANDLINE=$cmdline
check_kdump_cpus
@@ -515,6 +520,14 @@ kdump_target_handle_item()
value=1
target_is_root $dev || value=0
+ any_lvm)
+ # Sticky value is 1
+ [[ $value = "1" ]] && return
+
+ value=0
+ if [[ $dev =~ "/dev/mapper/" ]]; then
/dev/mapper/* could be other devices which is not lvm related?
+ value=1
+ fi
;;
*)
echo "unhandled item in kdump target checklist"
diff --git a/mkdumprd b/mkdumprd
index d27bf94..92d68a3 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -495,6 +495,11 @@ then
add_dracut_arg "--add-drivers" "$extra_modules"
fi
+# Omit "lvm" dracut module if we have no lvm targets.
+if ! kdump_targets_tell any_lvm ; then
+ add_dracut_arg "-o" "lvm"
+fi
+
dracut "${dracut_args[@]}" "$@"
_rc=$?
sync
--
1.8.3.1
_______________________________________________
kexec mailing list -- kexec(a)lists.fedoraproject.org
To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org
Thanks
Dave