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

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