PEL: Save BMC Version ID in UserData section
When creating a PEL, save the VERSION_ID value from the /etc/os-release
file in the UserData section that keeps useful system information.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I6d9008b15c5347239bf8c21ef79219d3b6ee08e6
diff --git a/extensions/openpower-pels/pel.cpp b/extensions/openpower-pels/pel.cpp
index 0c05ac1..e560d5e 100644
--- a/extensions/openpower-pels/pel.cpp
+++ b/extensions/openpower-pels/pel.cpp
@@ -37,6 +37,8 @@
namespace message = openpower::pels::message;
namespace pv = openpower::pels::pel_values;
+constexpr auto unknownValue = "Unknown";
+
PEL::PEL(const message::Entry& entry, uint32_t obmcLogID, uint64_t timestamp,
phosphor::logging::Entry::Level severity,
const AdditionalData& additionalData,
@@ -343,7 +345,7 @@
const std::optional<std::string>& pid,
const DataInterfaceBase& dataIface)
{
- std::string name = "Unknown";
+ std::string name{unknownValue};
try
{
@@ -363,6 +365,18 @@
json["Process Name"] = std::move(name);
}
+void addBMCFWVersionIDToJSON(nlohmann::json& json,
+ const DataInterfaceBase& dataIface)
+{
+ auto id = dataIface.getBMCFWVersionID();
+ if (id.empty())
+ {
+ id = unknownValue;
+ }
+
+ json["BMC Version ID"] = std::move(id);
+}
+
std::unique_ptr<UserData>
makeSysInfoUserDataSection(const AdditionalData& ad,
const DataInterfaceBase& dataIface)
@@ -370,6 +384,7 @@
nlohmann::json json;
addProcessNameToJSON(json, ad.getValue("_PID"), dataIface);
+ addBMCFWVersionIDToJSON(json, dataIface);
return makeJSONUserDataSection(json);
}