[kexec-tools] Fix various bugs for nfs dump

Cong Wang wangcong at fedoraproject.org
Wed Jan 25 08:58:47 UTC 2012


commit c461ec70578433d2f3427f091d1fdaca694a47da
Author: Cong Wang <xiyou.wangcong at gmail.com>
Date:   Wed Jan 25 16:58:35 2012 +0800

    Fix various bugs for nfs dump

 kdump_dracut_modules/99kdumpbase/module-setup.sh |   11 +------
 kexec-tools.spec                                 |    5 +++-
 mkdumprd                                         |   32 +++++++++++++++-------
 3 files changed, 28 insertions(+), 20 deletions(-)
---
diff --git a/kdump_dracut_modules/99kdumpbase/module-setup.sh b/kdump_dracut_modules/99kdumpbase/module-setup.sh
index 9214f44..e4efc90 100755
--- a/kdump_dracut_modules/99kdumpbase/module-setup.sh
+++ b/kdump_dracut_modules/99kdumpbase/module-setup.sh
@@ -24,25 +24,18 @@ to_udev_name() {
     echo ${dev#/dev/}
 }
 
-gen_new_conf () {
-    if [ ! -f $2 ]
-    then
-        sed -ne '/^#/!p' /etc/kdump.conf > $2
-    fi
-    sed -i -e "s#$1#/dev/$(to_udev_name $1)#" $2
-}
-
 depends() {
     echo "base shutdown"
     return 0
 }
 
 install() {
+    sed -ne '/^#/!p' /etc/kdump.conf > /tmp/$$-kdump.conf
     while read config_opt config_val;
     do
         case "$config_opt" in
         ext[234]|xfs|btrfs|minix|raw)
-            gen_new_conf $config_val /tmp/$$-kdump.conf
+            sed -i -e "s#$1#/dev/$(to_udev_name $1)#" /tmp/$$-kdump.conf
             ;;
         esac
     done < /etc/kdump.conf
diff --git a/kexec-tools.spec b/kexec-tools.spec
index 382ce74..ac5e0a8 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -1,6 +1,6 @@
 Name: kexec-tools
 Version: 2.0.3
-Release: 34%{?dist}
+Release: 35%{?dist}
 License: GPLv2
 Group: Applications/System
 Summary: The kexec/kdump userspace component.
@@ -289,6 +289,9 @@ done
 
 
 %changelog
+* Wed Jan 25 2012 Cong Wang <xiyou.wangcong at gmail.com> - 2.0.2-35
+- Fix various bugs for nfs dump.
+
 * Wed Jan 25 2012 Cong Wang <xiyou.wangcong at gmail.com> - 2.0.2-34
 - kdump.sh cleanup for fstab handling, from Dave Young.
 
diff --git a/mkdumprd b/mkdumprd
index 890acaa..baa5c96 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -10,7 +10,7 @@ export IN_KDUMP=1
 
 conf_file="/etc/kdump.conf"
 extra_modules=""
-dracut_args=("-m" "kdumpbase" "--add" "dash" "--add" "fstab-sys" "-c" "/dev/null" "-I" "/sbin/makedumpfile")
+dracut_args=("-m" "kdumpbase" "--add" "dash" "--add" "fstab-sys" "--add" "kernel-modules" "-c" "/dev/null" "-I" "/sbin/makedumpfile")
 
 add_dracut_arg() {
     while [ $# -gt 0 ];
@@ -79,6 +79,19 @@ check_remote() {
     return
 }
 
+add_mount() {
+    local _dev=$(to_dev_name "$1")
+    local _mnt=$(to_mount "$1")
+    if [ "$_dev" = "$(get_rootdev)" ]; then
+        :
+    elif [ -n "$_mnt" ]; then
+        add_dracut_mount "$_mnt"
+    else
+	return 1
+    fi
+    return 0
+}
+
 add_dracut_mount "$(to_mount "$(get_rootdev)")"
 if [ -n "$conf_file" ]; then
     while read config_opt config_val;
@@ -88,13 +101,8 @@ if [ -n "$conf_file" ]; then
             extra_modules="$extra_modules $config_val"
             ;;
         ext[234]|xfs|btrfs|minix)
-            _dev=$(to_dev_name "$config_val")
-            _mnt=$(to_mount "$config_val")
-            if [ "$_dev" = "$(get_rootdev)" ]; then
-                :
-            elif [ -n "$_mnt" ]; then
-                add_dracut_mount "$_mnt"
-            else
+            add_mount "$config_val"
+            if [ $? -ne 0 ]
                 echo "Dump target $config_val is probably not mounted."
                 exit 1
             fi
@@ -109,11 +117,15 @@ if [ -n "$conf_file" ]; then
                 add_dracut_module "ssh-client"
             else
                 add_dracut_module "nfs"
-                add_dracut_mount "$(to_mount $config_val)"
+                add_mount "$config_val"
+                if [ $? -ne 0 ]
+                    echo "Dump target $config_val is probably not mounted."
+                    exit 1
+                fi
             fi
             ;;
         core_collector)
-            add_dracut_arg "-I" "${config_val% *}"
+            add_dracut_arg "-I" "${config_val%% *}"
             ;;
         extra_bins)
             add_dracut_arg "-I" "$config_val"


More information about the scm-commits mailing list