kdumpctl: Prevent option --fadump on non-PPC in reset_crashkernel

Prevent the --fadump option to be used on non-PPC systems. This not only
prevents user errors but also guarantees that _dump_mode and _fadump_val are
empty on these systems.

Signed-off-by: Philipp Rudo <prudo@redhat.com>
Reviewed-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
Philipp Rudo 2023-09-06 10:49:42 +02:00 committed by Coiby Xu
parent f5785c60aa
commit 099434b993
1 changed files with 5 additions and 6 deletions

View File

@ -1551,6 +1551,10 @@ reset_crashkernel()
for _opt in "$@"; do
case "$_opt" in
--fadump=*)
if [[ $(uname -m) != ppc64le ]]; then
derror "Option --fadump only valid on PPC"
exit 1
fi
_val=${_opt#*=}
if _dump_mode=$(get_dump_mode_by_fadump_val $_val); then
_fadump_val=$_val
@ -1592,12 +1596,7 @@ reset_crashkernel()
return
fi
# For non-ppc64le systems, the dump mode is always kdump since only ppc64le
# has FADump.
if [[ -z $_dump_mode && $(uname -m) != ppc64le ]]; then
_dump_mode=kdump
_fadump_val=off
fi
[[ $(uname -m) != ppc64le ]] && _dump_mode=kdump
# If the dump mode is determined, we can also know the default crashkernel value
if [[ -n $_dump_mode ]]; then