Add elog dump type to common create
This commit modifies the Elog BMC dump creation process to utilize the
common BMC dump creation interface. Elog BMC dumps are a special type
of dumps triggered upon the logging of certain predefined set of error
logs. These dumps incorporate data based on the type of the error log.
In the existing process, upon occurrence of a predefined error log, the
error log watch function would inform the dump manager via an internal
DBus interface. Now, with this change, the error log watch function will
request the dump manager to create an Elog BMC dump that includes the
relevant error data, error type, and the object path of the error log
entry via the common create DBus interface.
Test:
Create an InternalFailure and make sure dump is created
>busctl call xyz.openbmc_project.Logging \
/xyz/openbmc_project/logging \
xyz.openbmc_project.Logging.Create Create ssa{ss} \
xyz.openbmc_project.Common.Error.InternalFailure \
xyz.openbmc_project.Logging.Entry.Level.Error 0
Trace:
phosphor-dump-manager[542]: Initiating new BMC dump \
with type: elog path: /xyz/openbmc_project/logging/entry/12
phosphor-dump-manager[2918]: Report is available in \
/var/lib/phosphor-debug-collector/dumps/6
Tested checkstop dump
Built with master and p10bmc
Change-Id: I734b052fc24e7893a61755790be49e8a1e594be5
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/elog_watch.cpp b/elog_watch.cpp
index 93c73e9..d128f12 100644
--- a/elog_watch.cpp
+++ b/elog_watch.cpp
@@ -32,8 +32,8 @@
using PropertyName = std::string;
using PropertyMap = std::map<PropertyName, AttributeMap>;
-Watch::Watch(sdbusplus::bus_t& bus, IMgr& iMgr) :
- iMgr(iMgr),
+Watch::Watch(sdbusplus::bus_t& bus, Mgr& mgr) :
+ mgr(mgr),
addMatch(bus,
sdbusplus::bus::match::rules::interfacesAdded() +
sdbusplus::bus::match::rules::path_namespace(OBJ_LOGGING),
@@ -118,9 +118,19 @@
auto errorType = etype.value();
- std::vector<std::string> fullPaths;
- fullPaths.push_back(objectPath);
-
+ DumpCreateParams params;
+ using DumpIntr = sdbusplus::common::xyz::openbmc_project::dump::Create;
+ using CreateParameters =
+ sdbusplus::common::xyz::openbmc_project::dump::Create::CreateParameters;
+ using DumpType =
+ sdbusplus::common::xyz::openbmc_project::dump::Create::DumpType;
+ params[DumpIntr::convertCreateParametersToString(
+ CreateParameters::FilePath)] = objectPath;
+ params[DumpIntr::convertCreateParametersToString(
+ CreateParameters::DumpType)] =
+ DumpIntr::convertDumpTypeToString(DumpType::ErrorLog);
+ params[DumpIntr::convertCreateParametersToString(
+ CreateParameters::ErrorType)] = errorType;
try
{
// Save the elog information. This is to avoid dump requests
@@ -128,16 +138,7 @@
elogList.insert(eId);
phosphor::dump::elog::serialize(elogList);
-
- auto item = std::find_if(phosphor::dump::bmc::TypeMap.begin(),
- phosphor::dump::bmc::TypeMap.end(),
- [errorType](const auto& err) {
- return (err.second == errorType);
- });
- if (item != phosphor::dump::bmc::TypeMap.end())
- {
- iMgr.IMgr::create((*item).first, fullPaths);
- }
+ mgr.Mgr::createDump(params);
}
catch (const QuotaExceeded& e)
{