Blame 0027-MCE-make-oops-and-vmcore-MCEs-a-bit-more-similar.patch

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