regulators: Add clearErrorHistory to Chassis class
Add a clearErrorHistory() method to the Chassis class. The method
should clear all data on previously logged errors. If the error occurs
again in the future, it will be logged again.
This method is normally called when the system is being powered on. For
code that runs repeatedly, errors are only logged once per boot.
When the system is powered off, hardware may be replaced that fixes the
problem. Thus, errors are cleared during power on.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I2b5c70004678fa48e28be48775cb6491a4d52090
diff --git a/phosphor-regulators/src/chassis.cpp b/phosphor-regulators/src/chassis.cpp
index f84540d..425c20e 100644
--- a/phosphor-regulators/src/chassis.cpp
+++ b/phosphor-regulators/src/chassis.cpp
@@ -39,6 +39,15 @@
}
}
+void Chassis::clearErrorHistory()
+{
+ // Clear error history in each device
+ for (std::unique_ptr<Device>& device : devices)
+ {
+ device->clearErrorHistory();
+ }
+}
+
void Chassis::closeDevices(Services& services)
{
// Log debug message in journal