[kexec-tools] Modify codes related to dump dir to make it clearer

Baoquan He baoquan at fedoraproject.org
Wed Feb 20 02:34:03 UTC 2013


commit c64f56348c411703f149f34aa1f9a77741135cac
Author: Baoquan He <bhe at redhat.com>
Date:   Fri Feb 1 11:00:12 2013 +0800

    Modify codes related to dump dir to make it clearer
    
    In previous patch, get_host_ip was introduced to make the dump dir
    more readable and back compatible with rhel6. But the implementation
    is not good, making variable DATEDIR ambiguous. In this patch, modify
    those codes to make it clearer.
    
    About code checking returned value of get_host_ip, if not zero the
    function do_default_action is called. That looks buggy, it will
    continue going through the later code flow. Add FINAL_ACTION after
    invoking do_default_action.
    
    Signed-off-by: Baoquan He <bhe at redhat.com>
    Acked-by: Dave Young <dyoung at redhat.com>

 dracut-kdump.sh |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index 4f4079c..d81ebc8 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -59,8 +59,8 @@ dump_fs()
     then
         mount -o remount,rw $_mp || return 1
     fi
-    mkdir -p $_mp/$KDUMP_PATH/$DATEDIR || return 1
-    $CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$DATEDIR/vmcore || return 1
+    mkdir -p $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR || return 1
+    $CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore || return 1
     umount $_mp || return 1
     return 0
 }
@@ -86,15 +86,15 @@ dump_raw()
 dump_rootfs()
 {
     mount -o remount,rw $NEWROOT/ || return 1
-    mkdir -p $NEWROOT/$KDUMP_PATH/$DATEDIR
-    $CORE_COLLECTOR /proc/vmcore $NEWROOT/$KDUMP_PATH/$DATEDIR/vmcore || return 1
+    mkdir -p $NEWROOT/$KDUMP_PATH/$HOST_IP-$DATEDIR
+    $CORE_COLLECTOR /proc/vmcore $NEWROOT/$KDUMP_PATH/$HOST_IP-$DATEDIR/vmcore || return 1
     sync
 }
 
 dump_ssh()
 {
     local _opt="-i $1 -o BatchMode=yes -o StrictHostKeyChecking=yes"
-    local _dir="$KDUMP_PATH/$DATEDIR"
+    local _dir="$KDUMP_PATH/$HOST_IP-$DATEDIR"
 
     cat /var/lib/random-seed > /dev/urandom
     ssh -q $_opt $2 mkdir -p $_dir || return 1
@@ -215,15 +215,13 @@ get_host_ip
 if [ $? -ne 0 ]; then
     echo "get_host_ip exited with non-zero status!"
     do_default_action
+    $FINAL_ACTION
 fi
 
 if [ -z "$DUMP_INSTRUCTION" ]; then
     add_dump_code "dump_rootfs"
 fi
 
-#refresh DATEDIR with crash host ip addr
-DATEDIR="$HOST_IP-$DATEDIR"
-
 do_kdump_pre
 if [ $? -ne 0 ]; then
     echo "kdump_pre script exited with non-zero status!"


More information about the scm-commits mailing list