mkdumprd: Add dracut watchdog module as default option
If dracut watchdog module is enabled then, it includes kernel watchdog module of active watchdog device in initramfs. kdump.conf has an option to modify dracut_args. So, if an user passes "-a watchdog" in dracut_args then dracut will add kernel watchdog module of active watchdog device in initramfs. Since, kexec-tools always requires to add kernel watchdog module of active watchdog device in initramfs, therefore even when an user does not pass any watchdog option and there exists at least one active watchdog device then also kexec-tools adds "-a watchdog" in dracut args. Therefore, if an user does not want to add kernel watchdog module in initramfs then the person must pass "-o watchdog" in dracut_args. Signed-off-by: Pratyush Anand <panand@redhat.com> Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
parent
182f742eed
commit
3095c3741f
24
kdump-lib.sh
24
kdump-lib.sh
@ -382,3 +382,27 @@ get_ifcfg_filename() {
|
||||
|
||||
echo -n "${ifcfg_file}"
|
||||
}
|
||||
|
||||
# returns 0 when omission of watchdog module is desired in dracut_args
|
||||
# returns 1 otherwise
|
||||
is_wdt_mod_omitted() {
|
||||
local dracut_args
|
||||
local ret=1
|
||||
|
||||
dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
|
||||
[[ -z $dracut_args ]] && return $ret
|
||||
|
||||
eval set -- $dracut_args
|
||||
while :; do
|
||||
[[ -z $1 ]] && break
|
||||
case $1 in
|
||||
-o|--omit)
|
||||
echo $2 | grep -qw "watchdog"
|
||||
[[ $? == 0 ]] && ret=0
|
||||
break
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
20
mkdumprd
20
mkdumprd
@ -16,8 +16,26 @@ SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
|
||||
# strip the duplicated "/"
|
||||
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
|
||||
|
||||
is_wdt_addition_needed() {
|
||||
local active
|
||||
|
||||
is_wdt_mod_omitted
|
||||
[[ $? -eq 0 ]] && return 1
|
||||
[[ -d /sys/class/watchdog/ ]] || return 1
|
||||
for dir in /sys/class/watchdog/*; do
|
||||
[[ -f "$dir/state" ]] || continue
|
||||
active=$(< "$dir/state")
|
||||
[[ "$active" = "active" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
WDTCFG=""
|
||||
is_wdt_addition_needed
|
||||
[[ $? -eq 0 ]] && WDTCFG="-a watchdog"
|
||||
|
||||
extra_modules=""
|
||||
dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg")
|
||||
dracut_args=("--hostonly" "-o" "plymouth dash resume ifcfg" $WDTCFG)
|
||||
OVERRIDE_RESETTABLE=0
|
||||
|
||||
add_dracut_arg() {
|
||||
|
Loading…
Reference in New Issue
Block a user