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