sensor-monitor: Changes for power off error
The hard and soft shutdown alarm errors are posted twice when a system
shuts down due to those thresholds being exceeded, once when the
threshold is first exceeded, and again when the shutdown actually
occurs. For these errors, make the following changes that will
differentiate them from the first time they were 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: I94a1cc9dad492e78f59619c4012bcaf6a4c81431
diff --git a/sensor-monitor/shutdown_alarm_monitor.cpp b/sensor-monitor/shutdown_alarm_monitor.cpp
index b4cd995..e5b6bf3 100644
--- a/sensor-monitor/shutdown_alarm_monitor.cpp
+++ b/sensor-monitor/shutdown_alarm_monitor.cpp
@@ -369,7 +369,7 @@
// Re-send the event log. If someone didn't want this it could be
// wrapped by a compile option.
- createEventLog(alarmKey, true, value);
+ createEventLog(alarmKey, true, value, true);
SDBusPlus::callMethod(systemdService, systemdPath, systemdMgrIface,
"StartUnit", "obmc-chassis-hard-poweroff@0.target",
@@ -402,7 +402,7 @@
void ShutdownAlarmMonitor::createEventLog(
const AlarmKey& alarmKey, bool alarmValue,
- const std::optional<double>& sensorValue)
+ const std::optional<double>& sensorValue, bool isPowerOffError)
{
using namespace sdbusplus::xyz::openbmc_project::Logging::server;
const auto& [sensorPath, shutdownType, alarmType] = alarmKey;
@@ -412,14 +412,33 @@
(alarmValue) ? alarmEventLogs.at(shutdownType).at(alarmType)
: alarmClearEventLogs.at(shutdownType).at(alarmType);
- Entry::Level severity =
- (alarmValue) ? Entry::Level::Error : Entry::Level::Informational;
+ // severity = Critical if a power off
+ // severity = Error if alarm was asserted
+ // severity = Informational if alarm was deasserted
+ Entry::Level severity = Entry::Level::Error;
+ if (isPowerOffError)
+ {
+ severity = Entry::Level::Critical;
+ }
+ else if (!alarmValue)
+ {
+ severity = Entry::Level::Informational;
+ }
if (sensorValue)
{
ad.emplace("SENSOR_VALUE", std::to_string(*sensorValue));
}
+ // 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");
+ }
+
SDBusPlus::callMethod(loggingService, loggingPath, loggingCreateIface,
"Create", errorName, convertForMessage(severity), ad);
}
diff --git a/sensor-monitor/shutdown_alarm_monitor.hpp b/sensor-monitor/shutdown_alarm_monitor.hpp
index 3558123..82f49a0 100644
--- a/sensor-monitor/shutdown_alarm_monitor.hpp
+++ b/sensor-monitor/shutdown_alarm_monitor.hpp
@@ -157,9 +157,12 @@
* @param[in] alarmKey - The alarm key
* @param[in] alarmValue - The alarm property value
* @param[in] sensorValue - The sensor value behind the alarm.
+ * @param[in] isPowerOffError - If this is committed at the time of the
+ * power off.
*/
void createEventLog(const AlarmKey& alarmKey, bool alarmValue,
- const std::optional<double>& sensorValue);
+ const std::optional<double>& sensorValue,
+ bool isPowerOffError = false);
/**
* @brief The sdbusplus bus object