kdump: Modify status routine to check for firmware-assisted dump
This patch enables kdump script to check if firmware-assisted dump is enabled or not by reading value from '/sys/kernel/fadump_enabled'. The determine_dump_mode() routine sets dump_mode to 'fadump', if fadump is enabled. By default, dump_mode is set to 'kdump' mode. Modify status routine to check if firmware assisted dump is registered or not by reading value from '/sys/kernel/fadump_registered' file. If it is set to '1' then return status=0 else return status=1. 0 <= Firmware assisted is enabled and running 1 <= Firmware assisted is enabled but not running Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com> Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
parent
0b63f4a522
commit
e0e70085e1
63
kdumpctl
63
kdumpctl
@ -9,6 +9,10 @@ MKDUMPRD="/sbin/mkdumprd -f"
|
|||||||
SAVE_PATH=/var/crash
|
SAVE_PATH=/var/crash
|
||||||
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
|
||||||
DUMP_TARGET=""
|
DUMP_TARGET=""
|
||||||
|
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
|
||||||
|
FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered"
|
||||||
|
#kdump shall be the default dump mode
|
||||||
|
DEFAULT_DUMP_MODE="kdump"
|
||||||
|
|
||||||
. /lib/kdump/kdump-lib.sh
|
. /lib/kdump/kdump-lib.sh
|
||||||
|
|
||||||
@ -34,6 +38,16 @@ single_instance_lock()
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
determine_dump_mode()
|
||||||
|
{
|
||||||
|
# Check if firmware-assisted dump is enabled
|
||||||
|
# if yes, set the dump mode as fadump
|
||||||
|
if is_fadump_capable; then
|
||||||
|
echo "Dump mode is fadump"
|
||||||
|
DEFAULT_DUMP_MODE="fadump"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]
|
# remove_cmdline_param <kernel cmdline> <param1> [<param2>] ... [<paramN>]
|
||||||
# Remove a list of kernel parameters from a given kernel cmdline and print the result.
|
# Remove a list of kernel parameters from a given kernel cmdline and print the result.
|
||||||
# For each "arg" in the removing params list, "arg" and "arg=xxx" will be removed if exists.
|
# For each "arg" in the removing params list, "arg" and "arg=xxx" will be removed if exists.
|
||||||
@ -436,6 +450,25 @@ propagate_ssh_key()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
is_fadump_capable()
|
||||||
|
{
|
||||||
|
# Check if firmware-assisted dump is enabled
|
||||||
|
# if no, fallback to kdump check
|
||||||
|
if [ -f $FADUMP_ENABLED_SYS_NODE ]; then
|
||||||
|
rc=`cat $FADUMP_ENABLED_SYS_NODE`
|
||||||
|
[ $rc -eq 1 ] && return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
check_current_fadump_status()
|
||||||
|
{
|
||||||
|
# Check if firmware-assisted dump has been registered.
|
||||||
|
rc=`cat $FADUMP_REGISTER_SYS_NODE`
|
||||||
|
[ $rc -eq 1 ] && return 0
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
check_current_kdump_status()
|
check_current_kdump_status()
|
||||||
{
|
{
|
||||||
rc=`cat /sys/kernel/kexec_crash_loaded`
|
rc=`cat /sys/kernel/kexec_crash_loaded`
|
||||||
@ -446,6 +479,17 @@ check_current_kdump_status()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_current_status()
|
||||||
|
{
|
||||||
|
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
|
||||||
|
check_current_fadump_status
|
||||||
|
else
|
||||||
|
check_current_kdump_status
|
||||||
|
fi
|
||||||
|
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
save_raw()
|
save_raw()
|
||||||
{
|
{
|
||||||
local kdump_dir
|
local kdump_dir
|
||||||
@ -608,6 +652,16 @@ check_fence_kdump_config()
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_dump_feasibility()
|
||||||
|
{
|
||||||
|
if [ $DEFAULT_DUMP_MODE == "fadump" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_kdump_feasibility
|
||||||
|
return $?
|
||||||
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
check_config
|
check_config
|
||||||
@ -625,13 +679,13 @@ start()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_kdump_feasibility
|
check_dump_feasibility
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Starting kdump: [FAILED]"
|
echo "Starting kdump: [FAILED]"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_current_kdump_status
|
check_current_status
|
||||||
if [ $? == 0 ]; then
|
if [ $? == 0 ]; then
|
||||||
echo "Kdump already running: [WARNING]"
|
echo "Kdump already running: [WARNING]"
|
||||||
return 0
|
return 0
|
||||||
@ -679,6 +733,9 @@ fi
|
|||||||
|
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
|
# Determine if the dump mode is kdump or fadump
|
||||||
|
determine_dump_mode
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
if [ -s /proc/vmcore ]; then
|
if [ -s /proc/vmcore ]; then
|
||||||
@ -693,7 +750,7 @@ main ()
|
|||||||
;;
|
;;
|
||||||
status)
|
status)
|
||||||
EXIT_CODE=0
|
EXIT_CODE=0
|
||||||
check_current_kdump_status
|
check_current_status
|
||||||
case "$?" in
|
case "$?" in
|
||||||
0)
|
0)
|
||||||
echo "Kdump is operational"
|
echo "Kdump is operational"
|
||||||
|
Loading…
Reference in New Issue
Block a user