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@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"
On 11/06/14 at 08:21pm, Prarit Bhargava wrote:
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.
How about making it as default feature. I mean remove the user configurable option and provide a "latest" softlink always.
I know this sounds too much, but I'd like to hear from others.
Thanks WANG Chao
Signed-off-by: Prarit Bhargava prarit@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
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 11/07/14 at 10:48am, WANG Chao wrote:
On 11/06/14 at 08:21pm, Prarit Bhargava wrote:
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.
How about making it as default feature. I mean remove the user configurable option and provide a "latest" softlink always.
I know this sounds too much, but I'd like to hear from others.
Thanks WANG Chao
Like the function of time-machine on OS X.
If you want to backup machine, the lastest soft link always links the lastest backup file. It is so convenience to find the lastest one.
Great.
Thanks Minfei
Signed-off-by: Prarit Bhargava prarit@redhat.com
kdump-lib-initramfs.sh | 10 ++++++++++ kdump.conf | 3 +++ kdump.conf.5 | 9 +++++++++ kdumpctl | 2 +- kexec-kdump-howto.txt | 5 +++++ +Latest Link
... skip ...
+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
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 11/06/2014 10:19 PM, Minfei Huang wrote:
On 11/07/14 at 10:48am, WANG Chao wrote:
On 11/06/14 at 08:21pm, Prarit Bhargava wrote:
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.
How about making it as default feature. I mean remove the user configurable option and provide a "latest" softlink always.
I know this sounds too much, but I'd like to hear from others.
Thanks WANG Chao
Like the function of time-machine on OS X.
If you want to backup machine, the lastest soft link always links the lastest backup file. It is so convenience to find the lastest one.
I mentioned this feature to vgoyal the other day. He brought up the valid case that someone may have a large number of systems and is dumping all of them to a single location via nfs or ssh. "latest" then becomes confusing. So he thinks this should only be done on local dumps.
I agree that it simplifies the code to remove the user config, and that user config options tend to be buried and unused.
Perhaps a happy medium is to do (sorry for the cut-and-paste):
+ if [ "$HOST_IP" == "127.0.0.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 + else + echo "kdump: creating link to $HOST_IP-latest" + rm -f $_mp/$KDUMP_PATH/$HOST_IP-latest + ln -sf $KDUMP_PATH/$HOST_IP-$DATEDIR $_mp/$KDUMP_PATH/$HOST_IP-latest + fi
and remove the config option?
P.
On 11/07/14 at 06:08am, Prarit Bhargava wrote:
On 11/06/2014 10:19 PM, Minfei Huang wrote:
On 11/07/14 at 10:48am, WANG Chao wrote:
On 11/06/14 at 08:21pm, Prarit Bhargava wrote:
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.
How about making it as default feature. I mean remove the user configurable option and provide a "latest" softlink always.
I know this sounds too much, but I'd like to hear from others.
Thanks WANG Chao
Like the function of time-machine on OS X.
If you want to backup machine, the lastest soft link always links the lastest backup file. It is so convenience to find the lastest one.
I mentioned this feature to vgoyal the other day. He brought up the valid case that someone may have a large number of systems and is dumping all of them to a single location via nfs or ssh. "latest" then becomes confusing. So he thinks this should only be done on local dumps.
I agree that it simplifies the code to remove the user config, and that user config options tend to be buried and unused.
Perhaps a happy medium is to do (sorry for the cut-and-paste):
- if [ "$HOST_IP" == "127.0.0.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
- else
echo "kdump: creating link to $HOST_IP-latest"
rm -f $_mp/$KDUMP_PATH/$HOST_IP-latest
ln -sf $KDUMP_PATH/$HOST_IP-$DATEDIR $_mp/$KDUMP_PATH/$HOST_IP-latest
- fi
If the dump target is dedicated ssh/nfs server and it's configured to be the dump target for many (say hundreds of) systems, there will be a lot of "latest" directories with different host-ip prefix there. I think that's kind of annoying. So I'll go with Vivek.
I'd like to keep this feature simple and clear. And that is just creating "latest" for local dumps. How about naming the latest - "latest-localhost" or something like that? Thoughts?
Thanks WANG Chao
and remove the config option?
That'll work for me.
Thanks WANG Chao
On 11/07/14 at 06:57am, Prarit Bhargava wrote:
On 11/07/2014 06:54 AM, WANG Chao wrote:
I'd like to keep this feature simple and clear. And that is just creating "latest" for local dumps. How about naming the latest - "latest-localhost" or something like that? Thoughts?
I think it is simple with latest IMO.
Sure. "latest" works for me.
On Fri, Nov 07, 2014 at 07:54:12PM +0800, WANG Chao wrote:
[..]
If the dump target is dedicated ssh/nfs server and it's configured to be the dump target for many (say hundreds of) systems, there will be a lot of "latest" directories with different host-ip prefix there. I think that's kind of annoying. So I'll go with Vivek.
I'd like to keep this feature simple and clear. And that is just creating "latest" for local dumps. How about naming the latest - "latest-localhost" or something like that? Thoughts?
I prefer not to do anything actually. I think it adds more code but does not buy us much.
- First of all it works only for local systems. So differentiating between two cases can be confusing for users.
- Secondly, I am wondering what will happen in case of clustered lvm kind of configuration or distributed file systems like gfs.
- It is really easy to either read time stamps or do "ll -rt" to figure out which is the lastest file.
- If somebody is already using a soft link "latest" in /var/crash/ dir for whatever reason, it will conflict with that too.
So I see more downsides then upside of this latest link thing. IMO, we should not do this.
Thanks Vivek
On 11/07/2014 12:48 PM, Vivek Goyal wrote:
On Fri, Nov 07, 2014 at 07:54:12PM +0800, WANG Chao wrote:
[..]
If the dump target is dedicated ssh/nfs server and it's configured to be the dump target for many (say hundreds of) systems, there will be a lot of "latest" directories with different host-ip prefix there. I think that's kind of annoying. So I'll go with Vivek.
I'd like to keep this feature simple and clear. And that is just creating "latest" for local dumps. How about naming the latest - "latest-localhost" or something like that? Thoughts?
I prefer not to do anything actually. I think it adds more code but does not buy us much.
First of all it works only for local systems. So differentiating between two cases can be confusing for users.
Secondly, I am wondering what will happen in case of clustered lvm kind of configuration or distributed file systems like gfs.
It is really easy to either read time stamps or do "ll -rt" to figure out which is the lastest file.
If somebody is already using a soft link "latest" in /var/crash/ dir for whatever reason, it will conflict with that too.
Okay, is there a "hook" in which I can do this automatically in kdump?
P.
So I see more downsides then upside of this latest link thing. IMO, we should not do this.
Thanks Vivek
On Fri, Nov 07, 2014 at 01:59:37PM -0500, Prarit Bhargava wrote:
On 11/07/2014 12:48 PM, Vivek Goyal wrote:
On Fri, Nov 07, 2014 at 07:54:12PM +0800, WANG Chao wrote:
[..]
If the dump target is dedicated ssh/nfs server and it's configured to be the dump target for many (say hundreds of) systems, there will be a lot of "latest" directories with different host-ip prefix there. I think that's kind of annoying. So I'll go with Vivek.
I'd like to keep this feature simple and clear. And that is just creating "latest" for local dumps. How about naming the latest - "latest-localhost" or something like that? Thoughts?
I prefer not to do anything actually. I think it adds more code but does not buy us much.
First of all it works only for local systems. So differentiating between two cases can be confusing for users.
Secondly, I am wondering what will happen in case of clustered lvm kind of configuration or distributed file systems like gfs.
It is really easy to either read time stamps or do "ll -rt" to figure out which is the lastest file.
If somebody is already using a soft link "latest" in /var/crash/ dir for whatever reason, it will conflict with that too.
Okay, is there a "hook" in which I can do this automatically in kdump?
Yes. kdump allows you to write your own script which can run after saving dump. Look at "kdump_post" option.
You can create a softlink there to customize it for your usage.
Thanks Vivek