[kexec-tools] raw core_collector fix

Dave Young yangrr at fedoraproject.org
Thu Jun 14 02:10:39 UTC 2012


commit b30eb78ab22c5d6d2890214beaa88162e61f0db4
Author: Dave Young <dyoung at redhat.com>
Date:   Thu Jun 14 09:57:07 2012 +0800

    raw core_collector fix
    
    1. only append '-F' for default core_collector internally
    2. error out if user does not add '-F' for makedumpfile
    
    v1->v2: refresh because of new core collector verify function
    v2->v3: optimize the code, remove local variable for default core_collector
    
    Signed-off-by: Dave Young <dyoung at redhat.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>

 dracut-kdump.sh |   10 ++++++++--
 mkdumprd        |   17 ++++++++++++-----
 2 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 8d169c4..df27227 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -93,7 +93,6 @@ dump_raw()
 
     monitor_dd_progress $_src_size_mb &
 
-    CORE_COLLECTOR=`echo $CORE_COLLECTOR | sed -e's/\(^makedumpfile\)\(.*$\)/\1 -F \2/'`
     $CORE_COLLECTOR /proc/vmcore | dd of=$1 bs=$DD_BLKSIZE >> /tmp/dd_progress_file 2>&1 || return 1
     return 0
 }
@@ -138,6 +137,11 @@ is_ssh_dump_target()
     grep -q "^net.*@" $conf_file
 }
 
+is_raw_dump_target()
+{
+    grep -q "^raw" $conf_file
+}
+
 read_kdump_conf()
 {
     if [ ! -f "$conf_file" ]; then
@@ -205,7 +209,9 @@ read_kdump_conf
 
 if [ -z "$CORE_COLLECTOR" ];then
     CORE_COLLECTOR=$DEFAULT_CORE_COLLECTOR
-    is_ssh_dump_target && CORE_COLLECTOR="$CORE_COLLECTOR -F"
+    if is_ssh_dump_target || is_raw_dump_target; then
+        CORE_COLLECTOR="$CORE_COLLECTOR -F"
+    fi
 fi
 
 if [ -z "$DUMP_INSTRUCTION" ]; then
diff --git a/mkdumprd b/mkdumprd
index f6ba6e1..accae0e 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -96,16 +96,23 @@ is_ssh_dump_target()
     grep -q "^net.*@" $conf_file
 }
 
+is_raw_dump_target()
+{
+    grep -q "^raw" $conf_file
+}
+
 # $1: core_collector config value
 verify_core_collector() {
     if grep -q "^raw" $conf_file && [ "${1%% *}" != "makedumpfile" ]; then
         echo "Warning: specifying a non-makedumpfile core collector, you will have to recover the vmcore manually."
     fi
-    if is_ssh_dump_target && [ "${1%% *}" = "makedumpfile" ]; then
-        ! strstr "$1" "-F" && {
-            echo "The specified dump target needs makedumpfile \"-F\" option."
-            exit 1
-        }
+    if is_ssh_dump_target || is_raw_dump_target; then
+        if [ "${1%% *}" = "makedumpfile" ]; then
+            ! strstr "$1" "-F" && {
+                echo "The specified dump target needs makedumpfile \"-F\" option."
+                exit 1
+            }
+        fi
     fi
 }
 


More information about the scm-commits mailing list