Add failure_action as alias of default and make default obsolete
In preparation for adding 'final_action' option, since it's confusing to have the 'final_action' and 'default' options at the same time, this patch introduces 'failure_action' as an alias of the 'default' option to /etc/kdump.conf, and makes 'default' obsolete to be removed in the future. Also, the "default action" term is renamed to "failure action". 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
0c24dce730
commit
cc95f0a744
@ -6,7 +6,7 @@
|
||||
# (at your option) any later version.
|
||||
|
||||
# This service will run the real kdump error handler code. Executing the
|
||||
# default action configured in kdump.conf
|
||||
# failure action configured in kdump.conf
|
||||
|
||||
[Unit]
|
||||
Description=Kdump Error Handler
|
||||
|
@ -6,5 +6,5 @@ set -o pipefail
|
||||
export PATH=$PATH:$KDUMP_SCRIPT_DIR
|
||||
|
||||
get_kdump_confs
|
||||
do_default_action
|
||||
do_failure_action
|
||||
do_final_action
|
||||
|
@ -71,8 +71,8 @@ The control flow of fadump works as follows:
|
||||
process.)
|
||||
09. Captures dump according to /etc/kdump.conf
|
||||
10. Is dump capture successful (yes goto 12, no goto 11)
|
||||
11. Perfom the default action specified in /etc/kdump.conf (Default action
|
||||
is reboot, if unspecified)
|
||||
11. Perform the failure action specified in /etc/kdump.conf
|
||||
(The default failure action is reboot, if unspecified)
|
||||
12. Reboot
|
||||
|
||||
|
||||
@ -227,12 +227,12 @@ to initate the dump and then click "Restart blade with NMI". This issues a
|
||||
system reset and invokes xmon debugger.
|
||||
|
||||
|
||||
Advanced Setups & Default action:
|
||||
Advanced Setups & Failure action:
|
||||
|
||||
Kdump and fadump exhibit similar behavior in terms of setup & default action.
|
||||
Kdump and fadump exhibit similar behavior in terms of setup & failure action.
|
||||
For fadump advanced setup related information see section "Advanced Setups" in
|
||||
"kexec-kdump-howto.txt" document. Refer to "Default action" section in "kexec-
|
||||
kdump-howto.txt" document for fadump default action related information.
|
||||
"kexec-kdump-howto.txt" document. Refer to "Failure action" section in "kexec-
|
||||
kdump-howto.txt" document for fadump failure action related information.
|
||||
|
||||
Compression and filtering
|
||||
|
||||
|
@ -6,7 +6,7 @@ KDUMP_PATH="/var/crash"
|
||||
CORE_COLLECTOR=""
|
||||
DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 1 -d 31"
|
||||
DMESG_COLLECTOR="/sbin/vmcore-dmesg"
|
||||
DEFAULT_ACTION="systemctl reboot -f"
|
||||
FAILURE_ACTION="systemctl reboot -f"
|
||||
DATEDIR=`date +%Y-%m-%d-%T`
|
||||
HOST_IP='127.0.0.1'
|
||||
DUMP_INSTRUCTION=""
|
||||
@ -51,22 +51,22 @@ get_kdump_confs()
|
||||
fence_kdump_nodes)
|
||||
FENCE_KDUMP_NODES="$config_val"
|
||||
;;
|
||||
default)
|
||||
failure_action|default)
|
||||
case $config_val in
|
||||
shell)
|
||||
DEFAULT_ACTION="kdump_emergency_shell"
|
||||
FAILURE_ACTION="kdump_emergency_shell"
|
||||
;;
|
||||
reboot)
|
||||
DEFAULT_ACTION="systemctl reboot -f"
|
||||
FAILURE_ACTION="systemctl reboot -f"
|
||||
;;
|
||||
halt)
|
||||
DEFAULT_ACTION="halt"
|
||||
FAILURE_ACTION="halt"
|
||||
;;
|
||||
poweroff)
|
||||
DEFAULT_ACTION="systemctl poweroff -f"
|
||||
FAILURE_ACTION="systemctl poweroff -f"
|
||||
;;
|
||||
dump_to_rootfs)
|
||||
DEFAULT_ACTION="dump_to_rootfs"
|
||||
FAILURE_ACTION="dump_to_rootfs"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
@ -159,10 +159,10 @@ kdump_emergency_shell()
|
||||
rm -f /etc/profile
|
||||
}
|
||||
|
||||
do_default_action()
|
||||
do_failure_action()
|
||||
{
|
||||
echo "Kdump: Executing default action $DEFAULT_ACTION"
|
||||
eval $DEFAULT_ACTION
|
||||
echo "Kdump: Executing failure action $FAILURE_ACTION"
|
||||
eval $FAILURE_ACTION
|
||||
}
|
||||
|
||||
do_final_action()
|
||||
|
@ -149,10 +149,10 @@ get_block_dump_target()
|
||||
|
||||
is_dump_to_rootfs()
|
||||
{
|
||||
grep "^default[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null
|
||||
grep -E "^(failure_action|default)[[:space:]]dump_to_rootfs" /etc/kdump.conf >/dev/null
|
||||
}
|
||||
|
||||
get_default_action_target()
|
||||
get_failure_action_target()
|
||||
{
|
||||
local _target
|
||||
|
||||
@ -181,7 +181,7 @@ get_kdump_targets()
|
||||
fi
|
||||
|
||||
# Add the root device if dump_to_rootfs is specified.
|
||||
_root=$(get_default_action_target)
|
||||
_root=$(get_failure_action_target)
|
||||
if [ -n "$_root" -a "$kdump_targets" != "$_root" ]; then
|
||||
kdump_targets="$kdump_targets $_root"
|
||||
fi
|
||||
|
12
kdump.conf
12
kdump.conf
@ -6,8 +6,8 @@
|
||||
# processed.
|
||||
#
|
||||
# Currently, only one dump target and path can be specified. If the dumping to
|
||||
# the configured target fails, the default action which can be configured via
|
||||
# the "default" directive will be performed.
|
||||
# the configured target fails, the failure action which can be configured via
|
||||
# the "failure_action" directive will be performed.
|
||||
#
|
||||
# Supported options:
|
||||
#
|
||||
@ -99,7 +99,7 @@
|
||||
# Multiple modules can be listed, separated by spaces, and any
|
||||
# dependent modules will automatically be included.
|
||||
#
|
||||
# default <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
# failure_action <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
# - Action to perform in case dumping fails.
|
||||
# reboot: Reboot the system.
|
||||
# halt: Halt the system.
|
||||
@ -110,6 +110,10 @@
|
||||
# reboot. 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.
|
||||
#
|
||||
# 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
|
||||
@ -155,7 +159,7 @@ core_collector makedumpfile -l --message-level 1 -d 31
|
||||
#kdump_pre /var/crash/scripts/kdump-pre.sh
|
||||
#extra_bins /usr/bin/lftp
|
||||
#extra_modules gfs2
|
||||
#default shell
|
||||
#failure_action shell
|
||||
#force_rebuild 1
|
||||
#force_no_rebuild 1
|
||||
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
|
||||
|
10
kdump.conf.5
10
kdump.conf.5
@ -148,7 +148,7 @@ modules can be listed, separated by spaces, and any
|
||||
dependent modules will automatically be included.
|
||||
.RE
|
||||
|
||||
.B default <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
.B failure_action <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
.RS
|
||||
Action to perform in case dumping to the intended target fails. The default is "reboot".
|
||||
reboot: Reboot the system (this is what most people will want, as it returns the system
|
||||
@ -156,10 +156,16 @@ to a normal state). halt: Halt the system and lose the vmcore. poweroff: The s
|
||||
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
|
||||
target is specified, the default action can be set as dump_to_rootfs. That means when
|
||||
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.
|
||||
.RE
|
||||
|
||||
.B default <reboot | halt | poweroff | shell | dump_to_rootfs>
|
||||
.RS
|
||||
Same as the "failure_action" directive above, but this directive is obsolete
|
||||
and will be removed in the future.
|
||||
.RE
|
||||
|
||||
.B force_rebuild <0 | 1>
|
||||
.RS
|
||||
By default, kdump initrd will only be rebuilt when necessary.
|
||||
|
38
kdumpctl
38
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|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|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" ] && {
|
||||
@ -247,7 +247,7 @@ check_config()
|
||||
esac
|
||||
done < $KDUMP_CONFIG_FILE
|
||||
|
||||
check_default_config || return 1
|
||||
check_failure_action_config || return 1
|
||||
|
||||
check_fence_kdump_config || return 1
|
||||
|
||||
@ -935,23 +935,35 @@ start_dump()
|
||||
return $?
|
||||
}
|
||||
|
||||
check_default_config()
|
||||
check_failure_action_config()
|
||||
{
|
||||
local default_option
|
||||
local failure_action
|
||||
local option="failure_action"
|
||||
|
||||
default_option=$(awk '$1 ~ /^default$/ {print $2;}' $KDUMP_CONFIG_FILE)
|
||||
if [ -z "$default_option" ]; then
|
||||
failure_action=$(awk '$1 ~ /^failure_action$/ {print $2;}' $KDUMP_CONFIG_FILE)
|
||||
|
||||
if [ -z "$failure_action" -a -z "$default_option" ]; then
|
||||
return 0
|
||||
else
|
||||
case "$default_option" in
|
||||
reboot|halt|poweroff|shell|dump_to_rootfs)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
echo $"Usage kdump.conf: default {reboot|halt|poweroff|shell|dump_to_rootfs}"
|
||||
return 1
|
||||
esac
|
||||
elif [ -n "$failure_action" -a -n "$default_option" ]; then
|
||||
echo "Cannot specify 'failure_action' and 'default' option together"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -n "$default_option" ]; then
|
||||
option="default"
|
||||
failure_action="$default_option"
|
||||
fi
|
||||
|
||||
case "$failure_action" in
|
||||
reboot|halt|poweroff|shell|dump_to_rootfs)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
echo $"Usage kdump.conf: $option {reboot|halt|poweroff|shell|dump_to_rootfs}"
|
||||
return 1
|
||||
esac
|
||||
}
|
||||
|
||||
start()
|
||||
|
@ -463,21 +463,21 @@ storage device, such as an iscsi target disk or clustered file system, you may
|
||||
need to manually specify additional kernel modules to load into your kdump
|
||||
initrd.
|
||||
|
||||
Default action
|
||||
Failure action
|
||||
==============
|
||||
Default action specifies what to do when dump to configured dump target
|
||||
fails. By default, default action is "reboot" and that is system reboots
|
||||
Failure action specifies what to do when dump to configured dump target
|
||||
fails. By default, failure action is "reboot" and that is system reboots
|
||||
if attempt to save dump to dump target fails.
|
||||
|
||||
There are other default actions available though.
|
||||
There are other failure actions available though.
|
||||
|
||||
- dump_to_rootfs
|
||||
This option tries to mount root and save dump on root filesystem
|
||||
in a path specified by "path". This option will generally make
|
||||
sense when dump target is not root filesystem. For example, if
|
||||
dump is being saved over network using "ssh" then one can specify
|
||||
default to "dump_to_rootfs" to try saving dump to root filesystem
|
||||
if dump over network fails.
|
||||
failure action to "dump_to_rootfs" to try saving dump to root
|
||||
filesystem if dump over network fails.
|
||||
|
||||
- shell
|
||||
Drop into a shell session inside initramfs.
|
||||
|
Loading…
Reference in New Issue
Block a user