Add final_action option to kdump.conf
If a crash occurs repeatedly after enabling kdump, the system goes into a crash loop and the dump target may get filled up by vmcores. This is likely especially with early kdump. This patch introduces 'final_action' option to kdump.conf, in order for users to be able to power off the system even after capturing a vmcore successfully. Signed-off-by: Kazuhito Hagio <k-hagio@ab.jp.nec.com> Cc: Dave Young <dyoung@redhat.com> Cc: Lianbo Jiang <lijiang@redhat.com> Cc: Bhupesh Sharma <bhsharma@redhat.com> Acked-by: Bhupesh Sharma <bhsharma@redhat.com> Acked-by: Dave Young <dyoung@redhat.com> Signed-off-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
parent
cc95f0a744
commit
242da37c58
@ -73,7 +73,8 @@ The control flow of fadump works as follows:
|
||||
10. Is dump capture successful (yes goto 12, no goto 11)
|
||||
11. Perform the failure action specified in /etc/kdump.conf
|
||||
(The default failure action is reboot, if unspecified)
|
||||
12. Reboot
|
||||
12. Perform the final action specified in /etc/kdump.conf
|
||||
(The default final action is reboot, if unspecified)
|
||||
|
||||
|
||||
How to configure fadump:
|
||||
|
@ -70,6 +70,19 @@ get_kdump_confs()
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
final_action)
|
||||
case $config_val in
|
||||
reboot)
|
||||
FINAL_ACTION="systemctl reboot -f"
|
||||
;;
|
||||
halt)
|
||||
FINAL_ACTION="halt"
|
||||
;;
|
||||
poweroff)
|
||||
FINAL_ACTION="systemctl poweroff -f"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done < $KDUMP_CONF
|
||||
|
||||
|
12
kdump.conf
12
kdump.conf
@ -105,15 +105,23 @@
|
||||
# halt: Halt the system.
|
||||
# poweroff: Power down the system.
|
||||
# shell: Drop to a bash shell.
|
||||
# Exiting the shell reboots the system.
|
||||
# Exiting the shell reboots the system by default,
|
||||
# or perform "final_action".
|
||||
# dump_to_rootfs: Dump vmcore to rootfs from initramfs context and
|
||||
# reboot. Useful when non-root dump target is specified.
|
||||
# reboot by default or perform "final_action".
|
||||
# Useful when non-root dump target is specified.
|
||||
# The default option is "reboot".
|
||||
#
|
||||
# default <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
# - Same as the "failure_action" directive above, but this directive
|
||||
# is obsolete and will be removed in the future.
|
||||
#
|
||||
# final_action <reboot | halt | poweroff>
|
||||
# - Action to perform in case dumping succeeds. Also performed
|
||||
# when "shell" or "dump_to_rootfs" failure action finishes.
|
||||
# Each action is same as the "failure_action" directive above.
|
||||
# The default is "reboot".
|
||||
#
|
||||
# force_rebuild <0 | 1>
|
||||
# - By default, kdump initrd will only be rebuilt when necessary.
|
||||
# Specify 1 to force rebuilding kdump initrd every time when kdump
|
||||
|
14
kdump.conf.5
14
kdump.conf.5
@ -155,9 +155,11 @@ reboot: Reboot the system (this is what most people will want, as it returns the
|
||||
to a normal state). halt: Halt the system and lose the vmcore. poweroff: The system
|
||||
will be powered down. shell: Drop to a shell session inside the initramfs, from which
|
||||
you can manually perform additional recovery actions. Exiting this shell reboots the
|
||||
system. Note: kdump uses bash as the default shell. dump_to_rootfs: If non-root dump
|
||||
system by default or performs "final_action".
|
||||
Note: kdump uses bash as the default shell. dump_to_rootfs: If non-root dump
|
||||
target is specified, the failure action can be set as dump_to_rootfs. That means when
|
||||
dumping to target fails, dump vmcore to rootfs from initramfs context and reboot.
|
||||
dumping to target fails, dump vmcore to rootfs from initramfs context and reboot
|
||||
by default or perform "final_action".
|
||||
.RE
|
||||
|
||||
.B default <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
@ -166,6 +168,14 @@ Same as the "failure_action" directive above, but this directive is obsolete
|
||||
and will be removed in the future.
|
||||
.RE
|
||||
|
||||
.B final_action <reboot | halt | poweroff>
|
||||
.RS
|
||||
Action to perform in case dumping to the intended target succeeds.
|
||||
Also performed when "shell" or "dump_to_rootfs" failure action finishes.
|
||||
Each action is same as the "failure_action" directive above.
|
||||
The default is "reboot".
|
||||
.RE
|
||||
|
||||
.B force_rebuild <0 | 1>
|
||||
.RS
|
||||
By default, kdump initrd will only be rebuilt when necessary.
|
||||
|
22
kdumpctl
22
kdumpctl
@ -228,7 +228,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|failure_action|default|force_rebuild|force_no_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|failure_action|default|final_action|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
|
||||
# remove inline comments after the end of a directive.
|
||||
config_val=$(strip_comments $config_val)
|
||||
[ -z "$config_val" ] && {
|
||||
@ -248,6 +248,7 @@ check_config()
|
||||
done < $KDUMP_CONFIG_FILE
|
||||
|
||||
check_failure_action_config || return 1
|
||||
check_final_action_config || return 1
|
||||
|
||||
check_fence_kdump_config || return 1
|
||||
|
||||
@ -966,6 +967,25 @@ check_failure_action_config()
|
||||
esac
|
||||
}
|
||||
|
||||
check_final_action_config()
|
||||
{
|
||||
local final_action
|
||||
|
||||
final_action=$(awk '$1 ~ /^final_action$/ {print $2;}' $KDUMP_CONFIG_FILE)
|
||||
if [ -z "$final_action" ]; then
|
||||
return 0
|
||||
else
|
||||
case "$final_action" in
|
||||
reboot|halt|poweroff)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
echo $"Usage kdump.conf: final_action {reboot|halt|poweroff}"
|
||||
return 1
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
check_dump_feasibility
|
||||
|
Loading…
Reference in New Issue
Block a user