kdumpctl: add showmem cmd

port from rhel, original patch is contributed by Minfei Huang:

Using /sys to determines crashkernel actual size is confusing since
there is no unit of measure.

Add a new command "kdumpctl showmem" to show the reserved memory kindly.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
Signed-off-by: Minfei Huang <mhuang@redhat.com>
Acked-by: Bhupesh Sharma <bhsharma@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Pingfan Liu 2018-05-11 10:02:39 +08:00 committed by Dave Young
parent 2884fed616
commit 1a6cb43a19
2 changed files with 15 additions and 1 deletions

View File

@ -830,6 +830,14 @@ propagate_ssh_key()
fi
}
show_reserved_mem()
{
local mem=3D$(cat /sys/kernel/kexec_crash_size)
local mem_mb=3D$(expr $mem / 1024 / 1024)
echo "Reserved "$mem_mb"MB memory for crash kernel"
}
handle_mode_switch()
{
if [ "$DEFAULT_DUMP_MODE" == "fadump" ]; then
@ -1246,8 +1254,11 @@ main ()
propagate)
propagate_ssh_key
;;
showmem)
show_reserved_mem
;;
*)
echo $"Usage: $0 {start|stop|status|restart|propagate}"
echo $"Usage: $0 {start|stop|status|restart|propagate|showmem}"
exit 1
esac
}

View File

@ -35,6 +35,9 @@ Is equal to
.I propagate
Helps to setup key authentication for ssh storage since it's
impossible to use password authentication during kdump.
.TP
.I showmem
Prints the size of reserved memory for crash kernel in megabytes.
.SH "SEE ALSO"
.BR kdump.conf (5),