baab13
From c86f483f58cc8e65030169965c2b4fe34911ef1d Mon Sep 17 00:00:00 2001
baab13
From: Denys Vlasenko <dvlasenk@redhat.com>
baab13
Date: Thu, 16 Jan 2014 13:11:20 +0100
baab13
Subject: [ABRT PATCH 27/27] MCE: make oops and vmcore MCEs a bit more similar
baab13
baab13
For oops-MCEs, change abrt-action-check-oops-for-hw-error
baab13
to write MCE description to "backtrace" instead of "comment"
baab13
element.
baab13
baab13
Extend abrt-action-check-oops-for-hw-error to be able to
baab13
detect vmcore MCEs: it will create "not-reportable" element
baab13
for them too, as it was doing it for oops-MCEs.
baab13
baab13
Add post-create processing to vmcore_event.conf which
baab13
runs abrt-action-check-oops-for-hw-error on vmcores.
baab13
Since that needs dmesg, dmesg extraction also moved
baab13
to this event from analyze_VMcore.
baab13
baab13
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
baab13
baab13
Related to rhbz#1032077
baab13
baab13
Signed-off-by: Jakub Filak <jfilak@redhat.com>
baab13
---
baab13
 src/plugins/abrt-action-check-oops-for-hw-error.in | 14 ++++++++++----
baab13
 src/plugins/vmcore_event.conf                      | 13 +++++++++----
baab13
 2 files changed, 19 insertions(+), 8 deletions(-)
baab13
baab13
diff --git a/src/plugins/abrt-action-check-oops-for-hw-error.in b/src/plugins/abrt-action-check-oops-for-hw-error.in
baab13
index ce13caf..2333fa1 100644
baab13
--- a/src/plugins/abrt-action-check-oops-for-hw-error.in
baab13
+++ b/src/plugins/abrt-action-check-oops-for-hw-error.in
baab13
@@ -70,7 +70,9 @@ if __name__ == "__main__":
baab13
     #
baab13
 
baab13
     # See if MCEs were seen
baab13
-    if not file_has_string("dmesg", "Machine check events logged"):
baab13
+    oops_mce = file_has_string("dmesg", "Machine check events logged");
baab13
+    vmcore_mce = file_has_string("backtrace", "Machine Check Exception:");
baab13
+    if not oops_mce and not vmcore_mce:
baab13
         sys.exit(0)
baab13
     #
baab13
     # There was an MCE. IOW: it's not a bug, it's a HW error.
baab13
@@ -81,11 +83,15 @@ if __name__ == "__main__":
baab13
     ))
baab13
     f.close()
baab13
 
baab13
+    # vmcore MCEs already have good backtrace element, nothing more to do
baab13
+    if vmcore_mce:
baab13
+        sys.exit(0)
baab13
+
baab13
     #
baab13
     # Did mcelog logged it to /var/log/mcelog
baab13
     # (RHEL6 by default does this)?
baab13
     if os.path.exists("/var/log/mcelog"):
baab13
-        f = open_or_die("comment", "w")
baab13
+        f = open_or_die("backtrace", "w")
baab13
         f.write("The kernel log indicates that hardware errors were detected.\n")
baab13
         f.write("/var/log/mcelog file may have more information.\n")
baab13
         f.write("The last 20 lines of /var/log/mcelog are:\n")
baab13
@@ -100,7 +106,7 @@ if __name__ == "__main__":
baab13
     # On RHEL7, mcelog is run so that its output ends up in syslog.
baab13
     # Do we see that?
baab13
     if file_has_string("/var/log/messages", "mcelog: Hardware event"):
baab13
-        f = open_or_die("comment", "w")
baab13
+        f = open_or_die("backtrace", "w")
baab13
         f.write("The kernel log indicates that hardware errors were detected.\n")
baab13
         f.write("System log may have more information.\n")
baab13
         f.write("The last 20 mcelog lines of system log are:\n")
baab13
@@ -114,7 +120,7 @@ if __name__ == "__main__":
baab13
     #
baab13
     # Apparently, there is no running mcelog daemon!
baab13
     # Let user know that he needs one.
baab13
-    f = open_or_die("comment", "w")
baab13
+    f = open_or_die("backtrace", "w")
baab13
     f.write("The kernel log indicates that hardware errors were detected.\n")
baab13
     f.write("The data was saved by kernel for processing by the mcelog tool.\n")
baab13
     f.write("However, neither /var/log/mcelog nor system log contain mcelog messages.\n")
baab13
diff --git a/src/plugins/vmcore_event.conf b/src/plugins/vmcore_event.conf
baab13
index a525ec7..34608d9 100644
baab13
--- a/src/plugins/vmcore_event.conf
baab13
+++ b/src/plugins/vmcore_event.conf
baab13
@@ -1,7 +1,6 @@
baab13
-# analyze
baab13
-EVENT=analyze_VMcore analyzer=vmcore
baab13
-        # If kdump machinery already extracted dmesg...
baab13
+EVENT=post-create analyzer=vmcore
baab13
         (
baab13
+        # If kdump machinery already extracted dmesg...
baab13
         if test -f vmcore-dmesg.txt; then
baab13
             # ...use that
baab13
             abrt-dump-oops -o vmcore-dmesg.txt >backtrace || exit $?
baab13
@@ -26,7 +25,13 @@ EVENT=analyze_VMcore analyzer=vmcore
baab13
             k=`sed -n '/Linux version/ s/.*Linux version \([^ ]*\) .*/\1/p' dmesg_log | tail -n1`
baab13
             test "$k" != "" && printf "%s" "$k" >kernel
baab13
         fi
baab13
-        ) &&
baab13
+        )
baab13
+        # Do not fail the event (->do not delete problem dir)
baab13
+        # if check-oops-for-hw-error exits nonzero:
baab13
+        { abrt-action-check-oops-for-hw-error || true; }
baab13
+
baab13
+# analyze
baab13
+EVENT=analyze_VMcore analyzer=vmcore
baab13
         abrt-action-analyze-oops &&
baab13
         abrt-action-save-kernel-data
baab13
 
baab13
-- 
baab13
1.8.3.1
baab13