[Patch v2 3/4] store the default dump target info when default target is a separate disk

Baoquan He bhe at redhat.com
Mon Mar 17 07:49:19 UTC 2014


If default target is a separate disk, the related information need be
stored in /etc/kdump.conf of kdump initramfs. This includes the disk
info which will help to deduce the dump_code and path which the vmcore
will be written into.

Signed-off-by: Baoquan He <bhe at redhat.com>
---
 dracut-module-setup.sh | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index bdadf7c..a2ee097 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -261,6 +261,37 @@ kdump_install_net() {
     fi
 }
 
+default_dump_target_install_conf()
+{
+    local _target _fstype
+    local _s  _t
+    local _mntpoint
+    local _path _save_path
+
+    is_user_configured_dump_target && return
+
+    _save_path=$(grep ^path "/etc/kdump.conf"| cut -d' '  -f2)
+    [ -z "$_save_path" ] && _save_path="/var/crash"
+
+    _mntpoint=$(df $SAVE_PATH | tail -1 |  awk '{print $NF}')
+    _target=$(df $SAVE_PATH | tail -1 |  awk '{print $1}')
+    if [ "$_mntpoint" != "/" ]; then
+        _fstype=$(findmnt -k -f -n -r -o FSTYPE $_target)
+
+        if [ "$_fstype" = "nfs" ];then
+            kdump_install_net "$_target"
+        else
+            _target=$(kdump_to_udev_name $_target)
+        fi
+
+        echo "$_fstype $_target" >> /tmp/$$-kdump.conf
+
+        _path=${_save_path##"$_mntpoint"}
+        sed -i -e "s#$_save_path#$_path#" /tmp/$$-kdump.conf
+    fi
+
+}
+
 #install kdump.conf and what user specifies in kdump.conf
 kdump_install_conf() {
     sed -ne '/^#/!p' /etc/kdump.conf > /tmp/$$-kdump.conf
@@ -285,6 +316,8 @@ kdump_install_conf() {
         esac
     done < /etc/kdump.conf
 
+    default_dump_target_install_conf
+
     kdump_check_fence_kdump
     inst "/tmp/$$-kdump.conf" "/etc/kdump.conf"
     rm -f /tmp/$$-kdump.conf
-- 
1.8.5.3



More information about the kexec mailing list