PEL: Update D-Bus event sev based on PEL severity
Put in checks to ensure the D-Bus event log severity agrees with the
final PEL severity for PELs created by the BMC. The D-bus property is
what is used in the Redfish event log, and we want to avoid cases like
having a Critical event log for an informational PEL.
This could happen in the case where the PEL message registry entry for
the event has a hardcoded or manufacturing specific severity value that
is different than the severity the D-Bus event log is first created
with.
This commit ensures that:
* If the PEL is nonError/recovered, the D-Bus severity is one of the
non error ones.
* If the PEL isn't nonError/recovered, then the D-Bus severity also
isn't.
* If the PEL is critical, the D-Bus severity is also critical.
It doesn't try to update the D-Bus severity for every PEL severity
because there isn't a one to one mapping - e.g. Notice, Debug, and
Informational D-Bus severities all map to a PEL severity of
nonError(informational).
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I6b0006034090e6d8e33e9f8b136ae50cce489f6e
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index d44fe35..152e4fb 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -20,6 +20,7 @@
#include "pel.hpp"
#include "pel_entry.hpp"
#include "service_indicators.hpp"
+#include "severity.hpp"
#include <fmt/format.h>
#include <sys/inotify.h>
@@ -403,6 +404,7 @@
auto policy = service_indicators::getPolicy(*_dataIface);
policy->activate(*pel);
+ updateDBusSeverity(*pel);
updateEventId(pel);
updateResolution(*pel);
createPELEntry(obmcLogID);
@@ -841,6 +843,40 @@
return false;
}
+void Manager::updateDBusSeverity(const openpower::pels::PEL& pel)
+{
+ // The final severity of the PEL may not agree with the
+ // original severity of the D-Bus event log. Update the
+ // D-Bus property to match in some cases. This is to
+ // ensure there isn't a Critical or Warning Redfish event
+ // log for an informational or recovered PEL (or vice versa).
+ // This doesn't make an explicit call to serialize the new
+ // event log property value because updateEventId() is called
+ // right after this and will do it.
+ auto sevType =
+ static_cast<SeverityType>(pel.userHeader().severity() & 0xF0);
+
+ auto entryN = _logManager.entries.find(pel.obmcLogID());
+ if (entryN != _logManager.entries.end())
+ {
+ auto newSeverity =
+ fixupLogSeverity(entryN->second->severity(), sevType);
+ if (newSeverity)
+ {
+ log<level::INFO>(
+ fmt::format(
+ "Changing event log {} severity from {} "
+ "to {} to match PEL",
+ entryN->second->id(),
+ Entry::convertLevelToString(entryN->second->severity()),
+ Entry::convertLevelToString(*newSeverity))
+ .c_str());
+
+ entryN->second->severity(*newSeverity, true);
+ }
+ }
+}
+
void Manager::setEntryPath(uint32_t obmcLogID)
{
Repository::LogID id{Repository::LogID::Obmc(obmcLogID)};