diff --git a/dracut-kdump-error-handler.service b/dracut-kdump-error-handler.service index 13090be..32b74ab 100644 --- a/dracut-kdump-error-handler.service +++ b/dracut-kdump-error-handler.service @@ -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 diff --git a/dracut-kdump-error-handler.sh b/dracut-kdump-error-handler.sh index 2f0f1d1..fc2b932 100755 --- a/dracut-kdump-error-handler.sh +++ b/dracut-kdump-error-handler.sh @@ -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 diff --git a/fadump-howto.txt b/fadump-howto.txt index be17da3..2730f4b 100644 --- a/fadump-howto.txt +++ b/fadump-howto.txt @@ -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 diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index f5155a4..8df2b6c 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -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() diff --git a/kdump-lib.sh b/kdump-lib.sh index 6acab8c..36a1043 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -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 diff --git a/kdump.conf b/kdump.conf index 286ad27..1c7408a 100644 --- a/kdump.conf +++ b/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 +# failure_action # - 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 +# - 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" diff --git a/kdump.conf.5 b/kdump.conf.5 index 990076e..c7098c9 100644 --- a/kdump.conf.5 +++ b/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 +.B failure_action .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 +.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. diff --git a/kdumpctl b/kdumpctl index ca47705..25d9c28 100755 --- a/kdumpctl +++ b/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() diff --git a/kexec-kdump-howto.txt b/kexec-kdump-howto.txt index f46563f..011a19f 100644 --- a/kexec-kdump-howto.txt +++ b/kexec-kdump-howto.txt @@ -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.