Add a latest soft link for local dumps, and a user configurable option
for other cases. This makes things easier when going through $path to
find the latest kdump.
Signed-off-by: Prarit Bhargava <prarit(a)redhat.com>
---
kdump-lib-initramfs.sh | 10 ++++++++++
kdump.conf | 3 +++
kdump.conf.5 | 9 +++++++++
kdumpctl | 2 +-
kexec-kdump-howto.txt | 5 +++++
5 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index f882b09..925eda6 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -18,6 +18,7 @@ KDUMP_CONF="/etc/kdump.conf"
KDUMP_PRE=""
KDUMP_POST=""
NEWROOT="/sysroot"
+LATEST_LINK=0
get_kdump_confs()
{
@@ -53,6 +54,9 @@ get_kdump_confs()
fence_kdump_nodes)
FENCE_KDUMP_NODES="$config_val"
;;
+ latest_link)
+ LATEST_LINK="$config_val"
+ ;;
default)
case $config_val in
shell)
@@ -112,6 +116,12 @@ dump_fs()
mv $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore-incomplete
$_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore
sync
+ if [ "$HOST_IP" == "127.0.0.1" ] || [ $LATEST_LINK -eq 1 ]; then
+ echo "kdump: creating link to latest"
+ rm -f $_mp/$KDUMP_PATH/latest
+ ln -sf $KDUMP_PATH/$HOST_IP-$DATEDIR $_mp/$KDUMP_PATH/latest
+ fi
+
echo "kdump: saving vmcore complete"
}
diff --git a/kdump.conf b/kdump.conf
index 54b581d..a70adde 100644
--- a/kdump.conf
+++ b/kdump.conf
@@ -141,6 +141,9 @@
# - List of cluster node(s) separated by space to send fence_kdump
# notification to (this option is mandatory to enable fence_kdump).
#
+# latest_link <0 | 1 >
+# - Adds a /$path/latest soft link to the latest crashdump
+#
#raw /dev/vg/lv_kdump
#ext4 /dev/vg/lv_kdump
diff --git a/kdump.conf.5 b/kdump.conf.5
index f1c2a2c..c1760ea 100644
--- a/kdump.conf.5
+++ b/kdump.conf.5
@@ -259,6 +259,15 @@ KDUMP_COMMANDLINE_APPEND to pass kernel command line options. Refer
to dracut.cmdline man page for more details on module blacklist option.
.RE
+.B latest_link <0 | 1>
+.RS
+Adds a /$path/latest soft link to the latest crashdump
+.PP
+0 - disabled
+.PP
+1 - enabled
+.RE
+
.RE
.SH EXAMPLES
diff --git a/kdumpctl b/kdumpctl
index ee3214a..4ccc0b8 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -242,7 +242,7 @@ check_config()
case "$config_opt" in
\#* | "")
;;
- raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
+ raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes|latest_link)
[ -z "$config_val" ] && {
echo "Invalid kdump config value for option $config_opt."
return 1;
diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt
index 5582e40..9866fc7 100644
--- a/kexec-kdump-howto.txt
+++ b/kexec-kdump-howto.txt
@@ -476,6 +476,11 @@ Core collector command format depends on dump target type. Typically
for
filesystem (local/remote), core_collector should accept two arguments.
First one is source file and second one is target file. For ex.
+Latest Link
+
+The 'latest_link' parameter can be set to one to create a 'latest' soft
link
+in the specifie dump path directory.
+
ex1.
---
core_collector "cp --sparse=always"
--
1.7.9.3
Show replies by thread