monitor: Re-log fan error on a power off
In the case where a power off rule runs to completion and powers off the
system due to either missing or faulted fans, at the point of power off
re-post the event log for the previous fan error.
This way, there can be an error associated with the power off, because
depending on the power off rule delays the original error could have
happened several minutes or more in the past.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I1a38062cf75ffd4a11baa417ef3983b6c1a47ada
diff --git a/monitor/json_parser.hpp b/monitor/json_parser.hpp
index ba53fda..c6b64ec 100644
--- a/monitor/json_parser.hpp
+++ b/monitor/json_parser.hpp
@@ -16,6 +16,7 @@
#pragma once
#include "json_config.hpp"
+#include "power_off_action.hpp"
#include "trust_group.hpp"
#include "types.hpp"
@@ -28,6 +29,7 @@
using json = nlohmann::json;
class PowerOffRule;
class PowerInterfaceBase;
+class System;
constexpr auto confAppName = "monitor";
constexpr auto confFileName = "config.json";
@@ -86,12 +88,16 @@
*
* @param[in] powerInterface - The power interface object to use
*
+ * @param[in] func - Optional user defined function that gets called
+ * right before a power off occurs.
+ *
* @return std::vector<std::unique_ptr<PowerOffRule>> -
* The PowerOffRule objects
*/
std::vector<std::unique_ptr<PowerOffRule>>
getPowerOffRules(const json& obj,
- std::shared_ptr<PowerInterfaceBase>& powerInterface);
+ std::shared_ptr<PowerInterfaceBase>& powerInterface,
+ PowerOffAction::PrePowerOffFunc& func);
/**
* @brief Returns the 'num_nonfunc_rotors_before_error field