[kexec-tools] kdumpctl, fadump: only use lsinitrd when initramfs exists in fadump mode

WANG Chao wangchao at fedoraproject.org
Wed Aug 6 04:06:48 UTC 2014


commit 83d14e0f39dff5dc9f2edc0b854d383587fa5a96
Author: WANG Chao <chaowang at redhat.com>
Date:   Tue Aug 5 13:51:16 2014 +0800

    kdumpctl, fadump: only use lsinitrd when initramfs exists in fadump mode
    
    When there's no kdump initramfs for lsinitrd to inspect with, there will
    be an error:
    
      # kdumpctl start
      /boot/initramfs-3.16.0-rc7+kdump.img does not exist
    
      Usage: lsinitrd [options] [<initramfs file> [<filename> [<filename> [...] ]]]
      Usage: lsinitrd [options] -k <kernel version>
    
      -h, --help                  print a help message and exit.
      -s, --size                  sort the contents of the initramfs by size.
      -m, --mod                   list modules.
      -f, --file <filename>       print the contents of <filename>.
      -k, --kver <kernel version> inspect the initramfs of <kernel version>.
    
    No kdump initial ramdisk found.
    Rebuilding /boot/initramfs-3.16.0-rc7+kdump.img
    [..]
    
    In addition, lsinitrd is a slow operation. We only run it when it's
    fadump mode, to speed up in kdump mode.
    
    Signed-off-by: WANG Chao <chaowang at redhat.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>

 kdumpctl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/kdumpctl b/kdumpctl
index 2bac6df..70d30fa 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -365,7 +365,9 @@ check_rebuild()
 	done
 
 	#check if target initrd has fadump support
-	initramfs_has_fadump=`lsinitrd -m $TARGET_INITRD | grep ^kdumpbase$ | wc -l`
+	if [ "$DEFAULT_DUMP_MODE" = "fadump" ] && [ -f "$TARGET_INITRD" ]; then
+		initramfs_has_fadump=`lsinitrd -m $TARGET_INITRD | grep ^kdumpbase$ | wc -l`
+	fi
 
 	if [ $image_time -eq 0 ]; then
 		echo  -n "No kdump initial ramdisk found."; echo


More information about the scm-commits mailing list