Blame SOURCES/0507-dracut.sh-introduce-no-hostonly-default-device-argum.patch

18971c
From 0e842c4b8b2796b9ae606da81ec92839af1cc27e Mon Sep 17 00:00:00 2001
18971c
From: Xunlei Pang <xlpang@redhat.com>
18971c
Date: Wed, 16 Aug 2017 13:55:17 +0800
18971c
Subject: [PATCH] dracut.sh: introduce "--no-hostonly-default-device" argument
18971c
18971c
Kdump doesn't need default host devices like root, swap, fstab, etc,
18971c
we only care about the dump target which can be added via "--mount"
18971c
or "--add-device". We met several issues that kdump kernel failed
18971c
due to one of those host devices added by dracut, additionally, the
18971c
needless devices(e.g. LVM) consume some appreciable amount of memory
18971c
which is more likely to cause OOM under memory-limited kdump.
18971c
18971c
So this patch introduced "--no-hostonly-default-device" to avoid
18971c
adding those default devices as host_devs.
18971c
18971c
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
18971c
18971c
Cherry-picked from: 37f2fe55d
18971c
Resolves: #1483838
18971c
---
18971c
 dracut.8.asc | 4 ++++
18971c
 dracut.sh    | 9 ++++++++-
18971c
 2 files changed, 12 insertions(+), 1 deletion(-)
18971c
18971c
diff --git a/dracut.8.asc b/dracut.8.asc
18971c
index 8fd863b9..e097e769 100644
18971c
--- a/dracut.8.asc
18971c
+++ b/dracut.8.asc
18971c
@@ -306,6 +306,10 @@ provide a valid _/etc/fstab_.
18971c
 **--no-hostonly-cmdline**:
18971c
     Do not store kernel command line arguments needed in the initramfs
18971c
 
18971c
+**--no-hostonly-default-device**:
18971c
+    Do not generate implicit host devices like root, swap, fstab, etc.
18971c
+    Use "--mount" or "--add-device" to explicitly add devices as needed.
18971c
+
18971c
 **--hostonly-i18n**:
18971c
     Install only needed keyboard and font files according to the host configuration (default).
18971c
 
18971c
diff --git a/dracut.sh b/dracut.sh
18971c
index f4e85095..0b23a838 100755
18971c
--- a/dracut.sh
18971c
+++ b/dracut.sh
18971c
@@ -141,6 +141,10 @@ Creates initial ramdisk images for preloading modules
18971c
                         in the initramfs
18971c
   --no-hostonly-cmdline Do not store kernel command line arguments needed
18971c
                         in the initramfs
18971c
+  --no-hostonly-default-device
18971c
+                        Do not generate implicit host devices like root,
18971c
+                        swap, fstab, etc. Use "--mount" or "--add-device"
18971c
+                        to explicitly add devices as needed.
18971c
   --hostonly-i18n       Install only needed keyboard and font files according
18971c
                         to the host configuration (default).
18971c
   --no-hostonly-i18n    Install all keyboard and font files available.
18971c
@@ -357,6 +361,7 @@ rearrange_params()
18971c
         --long no-host-only \
18971c
         --long hostonly-cmdline \
18971c
         --long no-hostonly-cmdline \
18971c
+        --long no-hostonly-default-device \
18971c
         --long persistent-policy: \
18971c
         --long fstab \
18971c
         --long help \
18971c
@@ -545,6 +550,8 @@ while :; do
18971c
                        i18n_install_all_l="yes" ;;
18971c
         --no-hostonly-cmdline)
18971c
                        hostonly_cmdline_l="no" ;;
18971c
+        --no-hostonly-default-device)
18971c
+                       hostonly_default_device="no" ;;
18971c
         --persistent-policy)
18971c
                        persistent_policy_l="$2";       PARMS_TO_STORE+=" '$2'"; shift;;
18971c
         --fstab)       use_fstab_l="yes" ;;
18971c
@@ -1039,7 +1046,7 @@ if (( ${#add_device_l[@]} )); then
18971c
     done
18971c
 fi
18971c
 
18971c
-if [[ $hostonly ]]; then
18971c
+if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
18971c
     # in hostonly mode, determine all devices, which have to be accessed
18971c
     # and examine them for filesystem types
18971c