On Tue, Jan 21, 2014 at 10:47:59PM +0530, Hari Bathini wrote:
This patch enables kdump script to check if firmware-assisted dump
is
enabled or not by reading value from '/sys/kernel/fadump_enabled'.
Modify status() routine to check if firmware assisted dump is enabled
or not by reading value from '/sys/kernel/fadump_enabled' file. If
enabled and value from '/sys/kernel/fadump_registered' file 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(a)linux.vnet.ibm.com>
---
kdumpctl | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/kdumpctl b/kdumpctl
index 46ae633..1255089 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -9,6 +9,8 @@ MKDUMPRD="/sbin/mkdumprd -f"
SAVE_PATH=/var/crash
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
DUMP_TARGET=""
+FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
+FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered"
. /lib/kdump/kdump-lib.sh
@@ -358,8 +360,38 @@ function propagate_ssh_key()
}
+function is_fadump_capable()
+{
+ # Check if firmware-assisted dump is enabled
+ # if yes, check fadump status Otherwise fallback to kdump check
+ if [ -f $FADUMP_ENABLED_SYS_NODE ] && \
+ [ -f $FADUMP_REGISTER_SYS_NODE ]
+ then
+ rc=`cat $FADUMP_ENABLED_SYS_NODE`
+ [ $rc -eq 1 ] && return 0
+ fi
+ return 1
+}
+
+function is_fadump_registered()
+{
+ # Check if firmware-assisted has been registered.
+ rc=`cat $FADUMP_REGISTER_SYS_NODE`
+ [ $rc -eq 1 ] && return 0
+ return 1
+}
+
function status()
{
+ # Check if firmware-assisted dump is enabled
+ # if yes, check fadump status Otherwise fallback to kdump check
+ if is_fadump_capable; then
+ if is_fadump_registered; then
+ return 0
+ fi
+ return 1
+ fi
What's the difference between fadump cabable and fadump enabled?
So if a machine is fadump capable, we always expect it to use fadump
only?
Thanks
Vivek