apport-hackers team mailing list archive
-
apport-hackers team
-
Mailing list archive
-
Message #00131
[Merge] lp:~louis-bouchard/apport/apport_kdump-tools-blueprint into lp:apport
Louis Bouchard has proposed merging lp:~louis-bouchard/apport/apport_kdump-tools-blueprint into lp:apport.
Requested reviews:
Apport upstream developers (apport-hackers)
For more details, see:
https://code.launchpad.net/~louis-bouchard/apport/apport_kdump-tools-blueprint/+merge/149498
Modified kernel_crashdump to pick up dmesg output from timestamped directory created by kdump-tools which replaces the kexec-tools mechanism to handle kernel crash dump
https://blueprints.launchpad.net/ubuntu/+spec/servercloud-r-kdump-tool
Includes sysv script modification
--
https://code.launchpad.net/~louis-bouchard/apport/apport_kdump-tools-blueprint/+merge/149498
Your team Apport upstream developers is requested to review the proposed merge of lp:~louis-bouchard/apport/apport_kdump-tools-blueprint into lp:apport.
=== modified file 'data/kernel_crashdump'
--- data/kernel_crashdump 2012-05-04 09:03:56 +0000
+++ data/kernel_crashdump 2013-02-20 09:30:32 +0000
@@ -11,35 +11,50 @@
# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
# the full text of the license.
-import os, sys
+import os, sys, re
import apport, apport.fileutils
-vmcore_path = os.path.join(apport.fileutils.report_dir, 'vmcore')
-
-if not os.path.exists(vmcore_path):
- sys.exit(0)
+vmcore_root = os.path.join(apport.fileutils.report_dir)
+vmcore_path = os.path.join(vmcore_root, 'vmcore')
pr = apport.Report('KernelCrash')
pr['Package'] = apport.packaging.get_kernel_package()
-pr['VmCore'] = (vmcore_path,)
pr.add_os_info()
if os.path.exists(vmcore_path + '.log'):
pr['VmCoreLog'] = (vmcore_path + '.log',)
-# write report
-try:
- with open(apport.fileutils.make_report_path(pr), 'wb') as f:
- pr.write(f)
-except IOError as e:
- apport.fatal('Cannot create report: ' + str(e))
+if os.path.exists(vmcore_path):
+ pr['VmCore'] = (vmcore_path,)
+ try:
+ with open(apport.fileutils.make_report_path(pr), 'wb') as f:
+ pr.write(f)
+ except IOError as e:
+ apport.fatal('Cannot create report: ' + str(e))
+else:
+# kdump-tools has moved vmcore to timestamped dir
+ for root, dirs, files in os.walk(vmcore_root):
+ for timedir in dirs:
+ if re.search('^[0-9]{12}$', timedir):
+ vmcore_dir = os.path.join(vmcore_root, timedir)
+ dmesgfile = os.path.join(vmcore_dir, 'dmesg.'+timedir)
+ pr['VmCoreDmesg'] = (dmesgfile,)
+ pr['Package'] = apport.packaging.get_kernel_package()+'-'+timedir
+ if not os.path.exists(apport.fileutils.make_report_path(pr)):
+ try:
+ with open(apport.fileutils.make_report_path(pr), 'wb') as f:
+ pr.write(f)
+ except IOError as e:
+ apport.fatal('Cannot create report: ' + str(e))
-# clean up the core files
-try:
- os.unlink(vmcore_path)
-except OSError:
- pass # huh, already gone?
-try:
- os.unlink(vmcore_path + '.log')
-except OSError:
- pass
+# clean up the core file
+# if not generated by kdump-tools
+if os.path.exists(vmcore_path):
+ try:
+ os.unlink(vmcore_path)
+ except OSError:
+ pass # huh, already gone?
+ try:
+ os.unlink(vmcore_path + '.log')
+ except OSError:
+ pass
=== modified file 'etc/init.d/apport'
--- etc/init.d/apport 2009-04-05 16:33:44 +0000
+++ etc/init.d/apport 2013-02-20 09:30:32 +0000
@@ -40,7 +40,7 @@
chmod 1777 /var/crash
# check for kernel crash dump, convert it to apport report
- if [ -e /var/crash/vmcore ]; then
+ if [ -e /var/crash/vmcore ] || [ "`ls /var/crash | egrep ^[0-9]{12}$`" ];then
/usr/share/apport/kernel_crashdump || true
fi