msl_verify: Create error log when verify fails
Create a Version::Incompatible error log when the verification
fails to make the failure more visible to the user.
Tested: Verified a new error log was created with the metadata.
"/xyz/openbmc_project/logging/entry/4": {
"AdditionalData": [
"_PID=1540",
"ACTUAL_VERSION=IPCS-FP5295G2-OP9-v2.0.8-2.8",
"MIN_VERSION=v2.2",
"VERSION_PURPOSE=xyz.openbmc_project.Software.Version.VersionPurpose.Host"
],
"Message": "xyz.openbmc_project.Software.Version.Error.Incompatible",
Change-Id: I3d13265b4a7e6a9a58cbd7cd619a162fb11da164
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/msl_verify_main.cpp b/msl_verify_main.cpp
index 85911dd..1810632 100644
--- a/msl_verify_main.cpp
+++ b/msl_verify_main.cpp
@@ -2,6 +2,10 @@
#include "msl_verify.hpp"
+#include <phosphor-logging/elog-errors.hpp>
+#include <phosphor-logging/elog.hpp>
+#include <xyz/openbmc_project/Software/Version/error.hpp>
+
int main(int argc, char* argv[])
{
using MinimumShipLevel = openpower::software::image::MinimumShipLevel;
@@ -9,7 +13,15 @@
if (!minimumShipLevel.verify())
{
- // TODO Create error log
+ using namespace phosphor::logging;
+ using IncompatibleErr = sdbusplus::xyz::openbmc_project::Software::
+ Version::Error::Incompatible;
+ using Incompatible =
+ xyz::openbmc_project::Software::Version::Incompatible;
+
+ report<IncompatibleErr>(prev_entry<Incompatible::MIN_VERSION>(),
+ prev_entry<Incompatible::ACTUAL_VERSION>(),
+ prev_entry<Incompatible::VERSION_PURPOSE>());
}
return 0;