kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size()

Resolves: bz1952342
Upstream: Fedora
Conflict: None

commit 45377836b014e22c27e5a210e679501f97ba4525
Author: Pingfan Liu <piliu@redhat.com>
Date:   Tue May 25 09:26:09 2021 +0800

    kdump-lib.sh: fix the case if no enough total RAM for kdump in get_recommend_size()

    For crashkernel=auto policy, if total RAM size is under a throttle,
    there is no memory reserved for kdump.

    Also correct a trivial bug by correcting the arch name.

    Signed-off-by: Pingfan Liu <piliu@redhat.com>
    Acked-by: Kairui Song <kasong@redhat.com>

Signed-off-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
Pingfan Liu 2021-05-25 10:36:01 +08:00
parent 53e6337ee2
commit 73929fc549
1 changed files with 7 additions and 2 deletions

View File

@ -894,6 +894,11 @@ get_recommend_size()
last_sz=""
last_unit=""
start=${_ck_cmdline: :1}
if [ $mem_size -lt $start ]; then
echo "0M"
return
fi
IFS=','
for i in $_ck_cmdline; do
end=$(echo $i | awk -F "-" '{ print $2 }' | awk -F ":" '{ print $1 }')
@ -921,9 +926,9 @@ kdump_get_arch_recommend_size()
fi
arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr [:lower:] [:upper:])
if [ $arch == "X86_64" ] || [ $arch == "S390" ]; then
if [ $arch == "X86_64" ] || [ $arch == "S390X" ]; then
ck_cmdline="1G-4G:160M,4G-64G:192M,64G-1T:256M,1T-:512M"
elif [ $arch == "ARM64" ]; then
elif [ $arch == "AARCH64" ]; then
ck_cmdline="2G-:448M"
elif [ $arch == "PPC64LE" ]; then
if is_fadump_capable; then