monitor: Changes for power off errors
When a fan error causes a power off due to a power off action being
triggered, the previous fan error is reposted at the time of the power
off. For this error, make the following changes that will differentiate
it from the first time it was logged:
1. Change severity to Critical
2. Set POWER_THERMAL_CRITICAL_FAULT=TRUE in the additional data
3. Set SEVERITY_DETAIL=SYSTEM_TERM in the additional data
Certain implementations, such as the IBM one, will take additional
actions based on these changes.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I5f36171e58493130114427f9e9fd870cd0d2dd76
diff --git a/monitor/fan_error.cpp b/monitor/fan_error.cpp
index 067858b..bb98598 100644
--- a/monitor/fan_error.cpp
+++ b/monitor/fan_error.cpp
@@ -50,10 +50,10 @@
}
}
-void FanError::commit(const json& jsonFFDC)
+void FanError::commit(const json& jsonFFDC, bool isPowerOffError)
{
FFDCFiles ffdc;
- auto ad = getAdditionalData();
+ auto ad = getAdditionalData(isPowerOffError);
// Add the Logger contents as FFDC
auto logFile = makeLogFFDCFile();
@@ -71,9 +71,16 @@
try
{
+ auto sev = _severity;
+
+ // If this is a power off, change severity to Critical
+ if (isPowerOffError)
+ {
+ using namespace sdbusplus::xyz::openbmc_project::Logging::server;
+ sev = convertForMessage(Entry::Level::Critical);
+ }
SDBusPlus::callMethod(loggingService, loggingPath, loggingCreateIface,
- "CreateWithFFDCFiles", _errorName, _severity, ad,
- ffdc);
+ "CreateWithFFDCFiles", _errorName, sev, ad, ffdc);
}
catch (const DBusError& e)
{
@@ -84,7 +91,8 @@
}
}
-std::map<std::string, std::string> FanError::getAdditionalData()
+std::map<std::string, std::string>
+ FanError::getAdditionalData(bool isPowerOffError)
{
std::map<std::string, std::string> ad;
@@ -96,6 +104,15 @@
ad.emplace("FAN_SENSOR", _sensorName);
}
+ // If this is a power off, specify that it's a power
+ // fault and a system termination. This is used by some
+ // implementations for service reasons.
+ if (isPowerOffError)
+ {
+ ad.emplace("POWER_THERMAL_CRITICAL_FAULT", "TRUE");
+ ad.emplace("SEVERITY_DETAIL", "SYSTEM_TERM");
+ }
+
return ad;
}