mkdumprd: apply dracut "--hostonly-cmdline" and "--no-hostonly-default-device"

Dracut has "--hostonly-cmdline" which can generate cmdlines(if any)
regarding the dump target, it's an existing way for us to use to
simplify the code. E.g. We already removed generate_lvm_cmdlines(),
to use "--hostonly-cmdline".

But "--hostonly-cmdline" has other issues(e.g. BZ1451717), it adds
needless devices for kdump like root device.

Now dracut supports "--no-hostonly-default-device" which enables
us to only add the kdump target, which can avoid needless devices
being recognized under kdump. Thus "--hostonly-cmdline" side effects
can be avoided with the help of "--no-hostonly-default-device".

This patch applies dracut's "--hostonly-cmdline" together with
"--no-hostonly-default-device" to achieve above-mentioned purpose.

Signed-off-by: Xunlei Pang <xlpang@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Xunlei Pang 2017-08-30 16:45:47 +08:00 committed by Dave Young
parent 31dc60ad20
commit e067d77dfc
3 changed files with 4 additions and 10 deletions

View File

@ -186,14 +186,6 @@ get_kdump_targets()
kdump_targets="$kdump_targets $_root"
fi
# NOTE:
# dracut parses devices from "/etc/fstab" with the "x-initrd.mount" option,
# which will be added as host_devs, it also includes usually simple devices
# (say mounted to /boot, /boot/efi/, etc) plus the root device. Then kdump
# must wait for these devices if initramfs is built with "--hostonly-cmdline".
#
# We don't pass "--hostonly-cmdline" to dracut, so there's no problem.
echo "$kdump_targets"
}

View File

@ -47,7 +47,7 @@ Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
Requires(pre): coreutils sed zlib
Requires: dracut >= 044-117
Requires: dracut >= 046-7
Requires: dracut-network >= 044-117
Requires: ethtool
BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel

View File

@ -37,7 +37,7 @@ is_wdt_addition_needed
[[ $? -eq 0 ]] && WDTCFG="-a watchdog"
extra_modules=""
dracut_args=("--hostonly" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG)
dracut_args=("--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG)
OVERRIDE_RESETTABLE=0
add_dracut_arg() {
@ -452,6 +452,8 @@ if ! is_fadump_capable; then
# The 2nd rootfs mount stays behind the normal dump target mount,
# so it doesn't affect the logic of check_dump_fs_modified().
is_dump_to_rootfs && add_mount "$(to_dev_name $(get_root_fs_device))"
add_dracut_arg "--no-hostonly-default-device"
fi
dracut "${dracut_args[@]}" "$@"