add function to check kdump config file
Add a function check_config to check kdump config file. 1. move multi dump target checking into this function 2. check invalid config options and obsolete config options 3. check null config value. [v2->v3]: add detail doc about deprecated options in kdump.conf manpage. [v3->v4]: print out the bad config option in case it is not valid. [v4->v5]: improve documentation according to comments from Vivek. [v5->v6]: s/Deprecated/Invalid for invalid config options. Signed-off-by: Dave Young <dyoung@redhat.com> Acked-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Marc Milgram <mmilgram@redhat.com>
This commit is contained in:
parent
69777ccff7
commit
81735539b8
47
kdump.conf.5
47
kdump.conf.5
@ -167,6 +167,53 @@ By default, kdump initrd only will be rebuilt when necessary.
|
||||
Specify 1 to force rebuilding kdump initrd every time when kdump service starts.
|
||||
.RE
|
||||
|
||||
.SH DEPRECATED OPTIONS
|
||||
|
||||
.B net <nfs mount>|<user@server>
|
||||
.RS
|
||||
net option is replaced by nfs and ssh options. Use nfs or ssh options
|
||||
directly.
|
||||
.RE
|
||||
|
||||
.B options <module> <option list>
|
||||
.RS
|
||||
Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump to add proper
|
||||
module option as kernel command line params. Such as append loop.max_loop=1
|
||||
to limit maximum loop devices to 1.
|
||||
.RE
|
||||
|
||||
.B link_delay <seconds>
|
||||
.RS
|
||||
link_delay was used to wait a network device to initialize before using it.
|
||||
Now dracut network module take care of this issue automaticlly.
|
||||
.RE
|
||||
|
||||
.B disk_timeout <seconds>
|
||||
.RS
|
||||
Similar to link_delay, dracut ensures disks being ready before kdump uses them.
|
||||
.RE
|
||||
|
||||
.B debug_mem_level <0-3>
|
||||
.RS
|
||||
This was used to turns on debug/verbose output of kdump scripts regarding
|
||||
free/used memory at various points of execution. This feature has been
|
||||
moved to dracut now.
|
||||
Use KDUMP_COMMANDLINE_APPEND in /etc/sysconfig/kdump and
|
||||
append dracut cmdline param rd.memdebug=[0-3] to enable the debug output.
|
||||
|
||||
Higher level means more debugging output.
|
||||
.PP
|
||||
0 - no output
|
||||
.PP
|
||||
1 - partial /proc/meminfo
|
||||
.PP
|
||||
2 - /proc/meminfo
|
||||
.PP
|
||||
3 - /proc/meminfo + /proc/slabinfo
|
||||
.RE
|
||||
|
||||
.RE
|
||||
|
||||
.SH EXAMPLES
|
||||
Here is some examples for core_collector option:
|
||||
.PP
|
||||
|
42
kdumpctl
42
kdumpctl
@ -72,6 +72,39 @@ function check_executable()
|
||||
done
|
||||
}
|
||||
|
||||
function check_config()
|
||||
{
|
||||
local nr
|
||||
|
||||
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
|
||||
[ $nr -gt 1 ] && {
|
||||
echo "More than one dump targets specified."
|
||||
return 1
|
||||
}
|
||||
|
||||
while read config_opt config_val; do
|
||||
case "$config_opt" in
|
||||
\#* | "")
|
||||
;;
|
||||
raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|blacklist|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild)
|
||||
[ -z "$config_val" ] && {
|
||||
echo "Invalid kdump config value for option $config_opt."
|
||||
return 1;
|
||||
}
|
||||
;;
|
||||
net|options|link_delay|disk_timeout|debug_mem_level)
|
||||
echo "Deprecated kdump config option: $config_opt. Refer to kdump.conf manpage for alternatives."
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
echo "Invalid kdump config option $config_opt"
|
||||
return 1;
|
||||
;;
|
||||
esac
|
||||
done < $KDUMP_CONFIG_FILE
|
||||
return 0
|
||||
}
|
||||
|
||||
function check_rebuild()
|
||||
{
|
||||
local extra_modules modified_files=""
|
||||
@ -347,12 +380,11 @@ function save_raw()
|
||||
|
||||
function start()
|
||||
{
|
||||
local nr
|
||||
nr=$(awk 'BEGIN{cnt=0} /^raw|^ssh[[:blank:]]|^nfs|^ext[234]|^xfs|^btrfs|^minix/{cnt++} END{print cnt}' $KDUMP_CONFIG_FILE)
|
||||
[ $nr -gt 1 ] && {
|
||||
echo "More than one dump targets specified: [WARNING]"
|
||||
check_config
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Starting kdump: [FAILED]"
|
||||
return 1
|
||||
}
|
||||
fi
|
||||
|
||||
save_raw
|
||||
if [ $? -ne 0 ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user