Enhance kdump.conf "default" parameters check.
According to man page, default option can only use reboot, halt, poweroff, shell and dump_to_rootfs as parameter. Currently, if configuration kdump.conf is: ------ path /var/crash core_collector makedumpfile -nosuchfile default no_such_option ------ kdump service still can be started. Adding function "check_default_config" to kdumpctl file can solve this problem. I have tested this patch in my test machine(Fedora-21). v1 --> v2 Baoquan He point "check_default_config" function should be call in "check_config" function. Wang Li point if kdump.conf donesn't configure the "default" option, kdump serivce will fail. Signed-off-by: Qiao Zhao <qzhao@redhat.com> Acked-by: Baoquan He <bhe@redhat.com> Acked-by: Minfei Huang <mhuang@redhat.com> Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
parent
e9ee834802
commit
daccbbe3af
21
kdumpctl
21
kdumpctl
@ -259,6 +259,8 @@ check_config()
|
|||||||
esac
|
esac
|
||||||
done < $KDUMP_CONFIG_FILE
|
done < $KDUMP_CONFIG_FILE
|
||||||
|
|
||||||
|
check_default_config || return 1
|
||||||
|
|
||||||
check_fence_kdump_config || return 1
|
check_fence_kdump_config || return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@ -781,6 +783,25 @@ start_dump()
|
|||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_default_config()
|
||||||
|
{
|
||||||
|
local default_option
|
||||||
|
|
||||||
|
default_option=$(awk '$1 ~ /^default$/ {print $2;}' $KDUMP_CONFIG_FILE)
|
||||||
|
if [ -z "$default_option" ]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
case "$default_option" in
|
||||||
|
reboot|halt|poweroff|shell|dump_to_rootfs)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Usage kdump.conf: default {reboot|halt|poweroff|shell|dump_to_rootfs}"
|
||||||
|
return 1
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
check_config
|
check_config
|
||||||
|
Loading…
Reference in New Issue
Block a user