kdump-lib.sh: kdump_get_arch_recommend_size uses crashkernel.default
The new `crashkernel.default` file in kernel package can be used as the ck_cmdline source. Also keep the legacy code so old kernel packages will still work. Signed-off-by: Kairui Song <kasong@redhat.com> Acked-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
231a75ac1b
commit
7b7ddaba88
37
kdump-lib.sh
37
kdump-lib.sh
@ -952,31 +952,40 @@ get_recommend_size()
|
|||||||
}
|
}
|
||||||
|
|
||||||
# return recommended size based on current system RAM size
|
# return recommended size based on current system RAM size
|
||||||
|
# $1: kernel version, if not set, will defaults to `uname -r`
|
||||||
kdump_get_arch_recommend_size()
|
kdump_get_arch_recommend_size()
|
||||||
{
|
{
|
||||||
if ! [[ -r "/proc/iomem" ]] ; then
|
local kernel=$1 arch
|
||||||
|
|
||||||
|
if ! [ -r "/proc/iomem" ] ; then
|
||||||
echo "Error, can not access /proc/iomem."
|
echo "Error, can not access /proc/iomem."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr [:lower:] [:upper:])
|
|
||||||
|
|
||||||
if [ $arch == "X86_64" ] || [ $arch == "S390X" ]; then
|
[ -z "$kernel" ] && kernel=$(uname -r)
|
||||||
ck_cmdline="1G-4G:160M,4G-64G:192M,64G-1T:256M,1T-:512M"
|
ck_cmdline=$(cat "/usr/lib/modules/$kernel/crashkernel.default" 2>/dev/null)
|
||||||
elif [ $arch == "AARCH64" ]; then
|
|
||||||
ck_cmdline="2G-:448M"
|
if [ -n "$ck_cmdline" ]; then
|
||||||
elif [ $arch == "PPC64LE" ]; then
|
ck_cmdline=${ck_cmdline#crashkernel=}
|
||||||
if is_fadump_capable; then
|
else
|
||||||
ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
|
arch=$(lscpu | grep Architecture | awk -F ":" '{ print $2 }' | tr '[:lower:]' '[:upper:]')
|
||||||
else
|
if [ "$arch" = "X86_64" ] || [ "$arch" = "S390X" ]; then
|
||||||
ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
|
ck_cmdline="1G-4G:160M,4G-64G:192M,64G-1T:256M,1T-:512M"
|
||||||
|
elif [ "$arch" = "AARCH64" ]; then
|
||||||
|
ck_cmdline="2G-:448M"
|
||||||
|
elif [ "$arch" = "PPC64LE" ]; then
|
||||||
|
if is_fadump_capable; then
|
||||||
|
ck_cmdline="4G-16G:768M,16G-64G:1G,64G-128G:2G,128G-1T:4G,1T-2T:6G,2T-4T:12G,4T-8T:20G,8T-16T:36G,16T-32T:64G,32T-64T:128G,64T-:180G"
|
||||||
|
else
|
||||||
|
ck_cmdline="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ck_cmdline=$(echo $ck_cmdline | sed -e 's/-:/-102400T:/g')
|
ck_cmdline=$(echo $ck_cmdline | sed -e 's/-:/-102400T:/g')
|
||||||
sys_mem=$(get_system_size)
|
sys_mem=$(get_system_size)
|
||||||
result=$(get_recommend_size $sys_mem "$ck_cmdline")
|
|
||||||
echo $result
|
get_recommend_size "$sys_mem" "$ck_cmdline"
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print all underlying crypt devices of a block device
|
# Print all underlying crypt devices of a block device
|
||||||
|
Loading…
Reference in New Issue
Block a user