PEL: Save invalid host PELs to a file
To aid in debug of when the host sends down an invalid PEL, save the PEL
to the file 'badPEL' in the PEL repo path. This only saves a single one
at a time to keep things simple.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I3b630433712d63cadd971aa87a02f76a9a366849
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index fb0efb3..66f5ee5 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -149,6 +149,13 @@
_eventLogger.log("org.open_power.Logging.Error.BadHostPEL",
Entry::Level::Error, ad);
+
+ // Save it to a file for debug in the lab. Just keep the latest.
+ // Not adding it to the PEL because it could already be max size
+ // and don't want to truncate an already invalid PEL.
+ std::ofstream pelFile{getPELRepoPath() / "badPEL"};
+ pelFile.write(reinterpret_cast<const char*>(pelData.data()),
+ pelData.size());
}
}