kdump: Introduce 'force_no_rebuild' option

This patch introduces the 'force_no_rebuild' option
inside the 'kdump.conf' and its handling inside the 'kdumpctl'
script.

There might be several use cases, where a system admin
decides that he doesn't need to rebuild the kdump initrd
and wants to use an existing version of the same. In such cases,
he can set the 'force_no_rebuild' option inside 'kdump.conf'
to 1, to force the 'kdumpctl' script not to rebuild the kdump
initrd.

Signed-off-by: Bhupesh Sharma <bhsharma@redhat.com>
Acked-by: Xunlei Pang <xlpang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Bhupesh Sharma 2017-04-12 11:14:18 +05:30 committed by Dave Young
parent 0165cfa332
commit a284fa9005
3 changed files with 39 additions and 1 deletions

View File

@ -115,6 +115,13 @@
# Specify 1 to force rebuilding kdump initrd every time when kdump # Specify 1 to force rebuilding kdump initrd every time when kdump
# service starts. # service starts.
# #
# force_no_rebuild <0 | 1>
# - By default, kdump initrd will be rebuilt when necessary.
# Specify 1 to bypass rebuilding of kdump initrd.
#
# force_no_rebuild and force_rebuild options are mutually
# exclusive and they should not be set to 1 simultaneously.
#
# override_resettable <0 | 1> # override_resettable <0 | 1>
# - Usually an unresettable block device can't be a dump target. # - Usually an unresettable block device can't be a dump target.
# Specifying 1 when you want to dump even though the block # Specifying 1 when you want to dump even though the block
@ -150,6 +157,7 @@ core_collector makedumpfile -l --message-level 1 -d 31
#extra_modules gfs2 #extra_modules gfs2
#default shell #default shell
#force_rebuild 1 #force_rebuild 1
#force_no_rebuild 1
#dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3" #dracut_args --omit-drivers "cfg80211 snd" --add-drivers "ext2 ext3"
#fence_kdump_args -p 7410 -f auto -c 0 -i 10 #fence_kdump_args -p 7410 -f auto -c 0 -i 10
#fence_kdump_nodes node1 node2 #fence_kdump_nodes node1 node2

View File

@ -166,6 +166,16 @@ By default, kdump initrd will only be rebuilt when necessary.
Specify 1 to force rebuilding kdump initrd every time when kdump service starts. Specify 1 to force rebuilding kdump initrd every time when kdump service starts.
.RE .RE
.B force_no_rebuild <0 | 1>
.RS
By default, kdump initrd will be rebuilt when necessary.
Specify 1 to bypass rebuilding of kdump initrd.
.PP
force_no_rebuild and force_rebuild options are mutually exclusive and
they should not be set to 1 simultaneously.
.RE
.B override_resettable <0 | 1> .B override_resettable <0 | 1>
.RS .RS
Usually an unresettable block device can't be a dump target. Specifying 1 means Usually an unresettable block device can't be a dump target. Specifying 1 means

View File

@ -367,7 +367,7 @@ check_config()
case "$config_opt" in case "$config_opt" in
\#* | "") \#* | "")
;; ;;
raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes) raw|ext2|ext3|ext4|minix|btrfs|xfs|nfs|ssh|sshkey|path|core_collector|kdump_post|kdump_pre|extra_bins|extra_modules|default|force_rebuild|force_no_rebuild|dracut_args|fence_kdump_args|fence_kdump_nodes)
[ -z "$config_val" ] && { [ -z "$config_val" ] && {
echo "Invalid kdump config value for option $config_opt." echo "Invalid kdump config value for option $config_opt."
return 1; return 1;
@ -627,6 +627,7 @@ check_rebuild()
{ {
local extra_modules local extra_modules
local _force_rebuild force_rebuild="0" local _force_rebuild force_rebuild="0"
local _force_no_rebuild force_no_rebuild="0"
local ret system_modified="0" local ret system_modified="0"
check_boot_dir check_boot_dir
@ -643,6 +644,15 @@ check_rebuild()
return 1 return 1
fi fi
_force_no_rebuild=`grep ^force_no_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
if [ $? -eq 0 ]; then
force_no_rebuild=`echo $_force_no_rebuild | cut -d' ' -f2`
if [ "$force_no_rebuild" != "0" ] && [ "$force_no_rebuild" != "1" ];then
echo "Error: force_no_rebuild value is invalid"
return 1
fi
fi
_force_rebuild=`grep ^force_rebuild $KDUMP_CONFIG_FILE 2>/dev/null` _force_rebuild=`grep ^force_rebuild $KDUMP_CONFIG_FILE 2>/dev/null`
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
force_rebuild=`echo $_force_rebuild | cut -d' ' -f2` force_rebuild=`echo $_force_rebuild | cut -d' ' -f2`
@ -652,6 +662,16 @@ check_rebuild()
fi fi
fi fi
if [[ "$force_no_rebuild" == "1" && "$force_rebuild" == "1" ]]; then
echo "Error: force_rebuild and force_no_rebuild are enabled simultaneously in kdump.conf"
return 1
fi
# Will not rebuild kdump initrd
if [ "$force_no_rebuild" == "1" ]; then
return 0
fi
#will rebuild every time if extra_modules are specified #will rebuild every time if extra_modules are specified
extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE` extra_modules=`grep ^extra_modules $KDUMP_CONFIG_FILE`
[ -n "$extra_modules" ] && force_rebuild="1" [ -n "$extra_modules" ] && force_rebuild="1"