psu-ng: Create errors for detected faults
Add in a function for creating errors using the Create D-Bus call.
Update the analyze function to create errors when faults are found.
We would want to log a fault per power supply, so move the faultLogged
concept down to the PowerSupply object itself.
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I94d22b2b8a495abde87fb921c9177c6d25225ef7
diff --git a/phosphor-power-supply/psu_manager.hpp b/phosphor-power-supply/psu_manager.hpp
index ca8fd05..06d7c82 100644
--- a/phosphor-power-supply/psu_manager.hpp
+++ b/phosphor-power-supply/psu_manager.hpp
@@ -121,8 +121,6 @@
{
psu->clearFaults();
}
-
- faultLogged = false;
}
private:
@@ -139,16 +137,24 @@
timer;
/**
+ * Create an error
+ *
+ * @param[in] faultName - 'name' message for the BMC error log entry
+ * @param[in] additionalData - The AdditionalData property for the error
+ */
+ void createError(const std::string& faultName,
+ const std::map<std::string, std::string>& additionalData);
+
+ /**
* Analyze the status of each of the power supplies.
+ *
+ * Log errors for faults, when and where appropriate.
*/
void analyze();
/** @brief True if the power is on. */
bool powerOn = false;
- /** @brief True if fault logged. Clear in clearFaults(). */
- bool faultLogged = false;
-
/** @brief Used as part of subscribing to power on state changes*/
std::string powerService;