Move the code to check /sys/kernel/kexec_crash_loaded to function
check_kdump_feasibility(). And rename status() to check_current_kdump_status()
so these two functions become clearer.
Signed-off-by: Dave Young <dyoung(a)redhat.com>
---
kdumpctl | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
--- kexec-tools.orig/kdumpctl
+++ kexec-tools/kdumpctl
@@ -384,12 +384,8 @@ function propagate_ssh_key()
}
-function status()
+function check_current_kdump_status()
{
- if [ ! -e /sys/kernel/kexec_crash_loaded ]
- then
- return 2
- fi
rc=`cat /sys/kernel/kexec_crash_loaded`
if [ $rc == 1 ]; then
return 0
@@ -534,6 +530,10 @@ function check_kdump_feasibility()
if is_secure_boot_enforced; then
return 1;
fi
+
+ if [ ! -e /sys/kernel/kexec_crash_loaded ]; then
+ return 2
+ fi
}
function start()
@@ -560,18 +560,15 @@ function start()
if [ $rc == 1 ]; then
echo "Secure boot is not supported in kdump yet. Please disable secure boot and
retry. [WARNING]"
return 1
- fi
-
- status
- rc=$?
- if [ $rc == 2 ]; then
+ elif [ $rc == 2 ]; then
echo "Kdump is not supported on this kernel: [WARNING]"
return 1;
- else
- if [ $rc == 0 ]; then
- echo "Kdump already running: [WARNING]"
- return 0
- fi
+ fi
+
+ check_current_kdump_status
+ if [ $? == 0 ]; then
+ echo "Kdump already running: [WARNING]"
+ return 0
fi
if check_ssh_config; then
Show replies by date