dracut-module-setup.sh: check whether to include multipath-hostonly or not

Due to the following commit in dracut, which splits out hostonly modules
commit 5ce7cc7337a4c769b223152c083914f2052aa348
Author: Harald Hoyer <harald@redhat.com>
Date:   Mon Jul 10 13:28:40 2017 +0200

    add 90multipath-hostonly module

    hardcoding the wwid of the drives in the initramfs causes problems
    when the drives are cloned to a system with the same hardware, but
    different disk wwid's

    https://bugzilla.redhat.com/show_bug.cgi?id=1457311

So kdump should decide whether to include the hostonly module.
The multipath-hostonly can help kdump to include only the needed mpath device,
in order to use less memory by 2nd kernel.

---- The performance -----
before this patch
[root@localhost ~]# time kdumpctl start
Detected change(s) in the following file(s):

  /etc/kdump.conf
Rebuilding /boot/initramfs-4.13.9-300.fc27.x86_64kdump.img
kexec: loaded kdump kernel
Starting kdump: [OK]

real    0m12.485s
user    0m10.096s
sys     0m1.887s

after this patch

root@localhost ~]# time kdumpctl start
Detected change(s) in the following file(s):

  /etc/kdump.conf
Rebuilding /boot/initramfs-4.13.9-300.fc27.x86_64kdump.img
kexec: loaded kdump kernel
Starting kdump: [OK]

real    0m15.839s
user    0m13.015s
sys     0m1.853s

Signed-off-by: Pingfan Liu <piliu@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
This commit is contained in:
Pingfan Liu 2017-11-23 10:17:54 +08:00 committed by Dave Young
parent bdd2ac6b93
commit c755499fad
1 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,13 @@ if ! [[ -d "${initdir}/tmp" ]]; then
mkdir -p "${initdir}/tmp"
fi
is_mpath() {
local _dev=$1
[ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
[[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
return 1
}
check() {
[[ $debug ]] && set -x
#kdumpctl sets this explicitly
@ -28,6 +35,7 @@ depends() {
_dep="$_dep network"
fi
for_each_host_dev_and_slaves is_mpath && _dep="$_dep multipath-hostonly"
echo $_dep
return 0
}