Async request to create PEL
To avoid any deadlocks between phosphor-logging and vpd-manager
service a wrapper around request to create PEL is created
which enables vpd-manager to make async requests to create PEL.
It also implements a new exception type to throw any GPIO
related exception. This was required to throw specific
exception.
Test:
Scenario 1:
While vpd-manager logs a pel with call out to an inventory
item.
It should be checked that both the services do not enter into
a deadlock situation.
Scenario 2:
Any third process is requesting to log PEL with call out
to an inventory item in a loop.
In the mean time vpd-manager also requests to log a PEL
with or without call out to inventory item.
All the pels should be logged correctly in the system.
No deadlock should appear.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: I0efaf6918e679ca94808fc70d747c843a50eaf78
diff --git a/ibm_vpd_utils.hpp b/ibm_vpd_utils.hpp
index 60903f9..2b75c7d 100644
--- a/ibm_vpd_utils.hpp
+++ b/ibm_vpd_utils.hpp
@@ -138,12 +138,32 @@
/**
* @brief API to create PEL entry
+ * The api makes synchronous call to phosphor-logging create api.
* @param[in] additionalData - Map holding the additional data
* @param[in] sev - Severity
* @param[in] errIntf - error interface
*/
+void createSyncPEL(const std::map<std::string, std::string>& additionalData,
+ const constants::PelSeverity& sev,
+ const std::string& errIntf);
+
+/**
+ * @brief Api to create PEL.
+ * A wrapper api through which sync/async call to phosphor-logging create api
+ * can be made as and when required.
+ * sdBus as nullptr will result in sync call else async call will be made with
+ * just "DESCRIPTION" key/value pair in additional data.
+ * To make asyn call with more fields in additional data call
+ * "sd_bus_call_method_async" in place.
+ *
+ * @param[in] additionalData - Map of additional data.
+ * @param[in] sev - severity of the PEL.
+ * @param[in] errIntf - Error interface to be used in PEL.
+ * @param[in] sdBus - Pointer to Sd-Bus
+ */
void createPEL(const std::map<std::string, std::string>& additionalData,
- const constants::PelSeverity& sev, const std::string& errIntf);
+ const constants::PelSeverity& sev, const std::string& errIntf,
+ sd_bus* sdBus);
/**
* @brief getVpdFilePath