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;
}
diff --git a/monitor/fan_error.hpp b/monitor/fan_error.hpp
index f190758..63e4e45 100644
--- a/monitor/fan_error.hpp
+++ b/monitor/fan_error.hpp
@@ -113,8 +113,10 @@
*
* @param[in] jsonFFDC - Free form JSON data that should be sent in as
* FFDC.
+ * @param[in] isPowerOffError - If this is committed at the time of the
+ * power off.
*/
- void commit(const nlohmann::json& jsonFFDC);
+ void commit(const nlohmann::json& jsonFFDC, bool isPowerOffError = false);
private:
/**
@@ -137,9 +139,11 @@
* @brief Create and returns the AdditionalData property to use for the
* event log.
*
+ * @param[in] isPowerOffError - If this is committed at the time of the
+ * power off.
* @return map<string, string> - The AdditionalData contents
*/
- std::map<std::string, std::string> getAdditionalData();
+ std::map<std::string, std::string> getAdditionalData(bool isPowerOffError);
/**
* @brief The error name (The event log's 'Message' property)
diff --git a/monitor/system.cpp b/monitor/system.cpp
index ea042cc..a6af9bf 100644
--- a/monitor/system.cpp
+++ b/monitor/system.cpp
@@ -300,7 +300,7 @@
// Still use the latest sensor data
auto sensorData = captureSensorData();
- _lastError->commit(sensorData);
+ _lastError->commit(sensorData, true);
}
}