[kexec-tools] Handle new crashkernel= syntax in firstboot

Dave Young yangrr at fedoraproject.org
Thu Aug 9 02:48:22 UTC 2012


commit dfb10612a2c267e73abf39ba9592989dd636a3f1
Author: Dave Young <dyoung at redhat.com>
Date:   Thu Aug 9 10:22:49 2012 +0800

    Handle new crashkernel= syntax in firstboot
    
    Resolves: bz805782
    
    Port from below patch from rhel:
    commit 6a6816e97fccaf7805ba9d04fcb3f58d87bd2517
    Author: amwang <amwang at redhat.com>
    Date:   Fri Feb 11 06:53:27 2011 +0000
    
        Resolves: bug 676758.
    
    Signed-off-by: Dave Young <dyoung at redhat.com>
    Acked-by: Vivek Goyal <vgoyal at redhat.com>

 firstboot_kdump.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/firstboot_kdump.py b/firstboot_kdump.py
index c7d1171..7aec3cd 100755
--- a/firstboot_kdump.py
+++ b/firstboot_kdump.py
@@ -147,7 +147,6 @@ class moduleClass(Module):
 
 		# Fix up memory calculations if kdump is already on
 		cmdLine = open("/proc/cmdline").read()
-		self.kdumpMem = 0
 		self.kdumpOffset = 0
 		self.origCrashKernel = ""
 		self.kdumpEnabled = False
@@ -155,7 +154,11 @@ class moduleClass(Module):
 		if chkConfigStatus.find("enabled") > -1:
 			self.kdumpEnabled = True
 		self.kdumpMemInitial = 0
-		if cmdLine.find("crashkernel") > -1:
+
+		kexec_crash_size = open("/sys/kernel/kexec_crash_size").read()
+		self.kdumpMem = int(kexec_crash_size)/(1024*1024)
+
+		if self.kdumpMem != 0:
 			crashString = filter(lambda t: t.startswith("crashkernel="),
 					 cmdLine.split())[0].split("=")[1]
 			if self.doDebug:
@@ -163,7 +166,6 @@ class moduleClass(Module):
 			if crashString.find("@") != -1:
 				(self.kdumpMem, self.kdumpOffset) = [int(m[:-1]) for m in crashString.split("@")]
 			else:
-				self.kdumpMem = int(crashString[:-1])
 				self.kdumpOffset = 0
 			self.availMem += self.kdumpMem
 			self.origCrashKernel = "%dM" % (self.kdumpMem)
@@ -171,6 +173,7 @@ class moduleClass(Module):
 			self.kdumpEnabled = True
 		else:
 			self.kdumpEnabled = False
+
 		self.initialState = self.kdumpEnabled
 
 		# Do some sanity-checking and try to present only sane options.


More information about the scm-commits mailing list