kdumpctl: drop _get_current_running_kernel_path
_get_current_running_kernel_path is identical to _find_kernel_path_by_release $(uname -r) so simply use this instead of defining a new function. While at it simplify reset_crashkernel slightly. This changes the behavior of the function for the case when KDUMP_KERNELVER is defined but no kernel with this version is installed. Before, the missing kernel is silently ignored and the currently running kernel is used instead. Now, kdumpctl will exit with an error. Signed-off-by: Philipp Rudo <prudo@redhat.com> Reviewed-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
f01fef4016
commit
b9738affc9
23
kdumpctl
23
kdumpctl
@ -1422,18 +1422,6 @@ _find_kernel_path_by_release()
|
||||
echo -n "$_kernel_path"
|
||||
}
|
||||
|
||||
_get_current_running_kernel_path()
|
||||
{
|
||||
local _release _path
|
||||
|
||||
_release=$(uname -r)
|
||||
if _path=$(_find_kernel_path_by_release "$_release"); then
|
||||
echo -n "$_path"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
_update_kernel_cmdline()
|
||||
{
|
||||
local _kernel_path=$1 _crashkernel=$2 _dump_mode=$3 _fadump_val=$4
|
||||
@ -1628,14 +1616,11 @@ reset_crashkernel()
|
||||
# - use KDUMP_KERNELVER if it's defined
|
||||
# - use current running kernel
|
||||
if [[ -z $_grubby_kernel_path ]]; then
|
||||
if [[ -z $KDUMP_KERNELVER ]] ||
|
||||
! _kernel_path=$(_find_kernel_path_by_release "$KDUMP_KERNELVER"); then
|
||||
if ! _kernel_path=$(_get_current_running_kernel_path); then
|
||||
derror "no running kernel found"
|
||||
exit 1
|
||||
fi
|
||||
[[ -n $KDUMP_KERNELVER ]] || KDUMP_KERNELVER=$(uname -r)
|
||||
if ! _kernels=$(_find_kernel_path_by_release "$KDUMP_KERNELVER"); then
|
||||
derror "no kernel for version $KDUMP_KERNELVER found"
|
||||
exit 1
|
||||
fi
|
||||
_kernels=$_kernel_path
|
||||
else
|
||||
_kernels=$(_get_all_kernels_from_grubby "$_grubby_kernel_path")
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user