summaryrefslogtreecommitdiffstats
path: root/elog_serialize.cpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2018-05-01 15:20:55 -0500
committerMatt Spinler <spinler@us.ibm.com>2018-05-01 15:46:23 -0500
commit375ac9b9e575e97932b308dd4a1822dd538d511c (patch)
treea1562c4651c4c11bdbd1439426ff971eebc0e489 /elog_serialize.cpp
parent1275bd13cc207167b489f661d10a7263b211bbcb (diff)
downloadphosphor-logging-375ac9b9e575e97932b308dd4a1822dd538d511c.tar.gz
phosphor-logging-375ac9b9e575e97932b308dd4a1822dd538d511c.zip
Add the BMC code version to error logs
Add the xyz.openbmc_project.Software.Version interface to the elog entries. This allows a user to know what BMC code level was running when the error was created. The level is persisted along with the other elog fields. If this code is flashed on a system that was running older code, and there were existing error logs, the version property will be left empty in the restored log entries. Older code is still able to restore logs created by this code as the version property is at the end of the serialized data and so is just ignored by Cereal. Resolves openbmc/openbmc#3133 Tested: Check that new error logs have the code level, and that restarting phosphor-log-manager preserves that property on the existing logs. Various incantations of running the older code with logs created by this code, and running this code with logs created by older code. Change-Id: I682aa3bf97c8352ce6dda05dfdf55d33173de891 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'elog_serialize.cpp')
-rw-r--r--elog_serialize.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/elog_serialize.cpp b/elog_serialize.cpp
index 1af1946..d807a93 100644
--- a/elog_serialize.cpp
+++ b/elog_serialize.cpp
@@ -29,7 +29,8 @@ template<class Archive>
void save(Archive& a, const Entry& e, const std::uint32_t version)
{
a(e.id(), e.severity(), e.timestamp(),
- e.message(), e.additionalData(), e.associations(), e.resolved());
+ e.message(), e.additionalData(), e.associations(), e.resolved(),
+ e.version());
}
/** @brief Function required by Cereal to perform deserialization.
@@ -52,9 +53,18 @@ void load(Archive& a, Entry& e, const std::uint32_t version)
std::vector<std::string> additionalData{};
bool resolved{};
AssociationList associations{};
+ std::string fwVersion{};
- a(id, severity, timestamp, message,
- additionalData, associations, resolved);
+ if (version < std::stoul(FIRST_CEREAL_CLASS_VERSION_WITH_FWLEVEL))
+ {
+ a(id, severity, timestamp, message,
+ additionalData, associations, resolved);
+ }
+ else
+ {
+ a(id, severity, timestamp, message,
+ additionalData, associations, resolved, fwVersion);
+ }
e.id(id);
e.severity(severity);
@@ -64,6 +74,9 @@ void load(Archive& a, Entry& e, const std::uint32_t version)
e.sdbusplus::xyz::openbmc_project::
Logging::server::Entry::resolved(resolved);
e.associations(associations);
+ e.version(fwVersion);
+ e.purpose(sdbusplus::xyz::openbmc_project::Software::
+ server::Version::VersionPurpose::BMC);
}
fs::path serialize(const Entry& e, const fs::path& dir)
OpenPOWER on IntegriCloud