Add support core dump in common create
This commit modifies the interaction between the core dump monitor and
the BMC dump manager. Earlier, when a process managed by systemd
crashed, it generated a core dump. The core dump monitor would then
inform the dump manager about this event through a dedicated internal
D-Bus interface.
With this commit, we change this approach and leverage the common BMC
dump creation interface. Now, when a core dump is generated, the core
dump monitor requests the dump manager to create a specific BMC dump
that incorporates this core dump data.
Tests:
Create a core dump and make sure BMC dump with core
is created
>kill -3 2232
Trace:
phosphor-dump-manager[542]: Initiating new BMC dump with \
type: core path: /var/lib/systemd/coredump/core.openpower\
-occ-c.0.0b16f513a5bc43f98ea11ed525f1a0c5.2232.16889058660\
00000.zst
Built with master and p10bmc
phosphor-dump-manager[2738]: Report is available in /var/\
lib/phosphor-debug-collector/dumps/5
Change-Id: Ic2cc723babccb0f8d36504992996bcf418db8463
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/core_manager.cpp b/core_manager.cpp
index 554d969..a2219c3 100644
--- a/core_manager.cpp
+++ b/core_manager.cpp
@@ -52,14 +52,12 @@
constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper";
constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper";
- constexpr auto IFACE_INTERNAL("xyz.openbmc_project.Dump.Internal.Create");
- constexpr auto APPLICATION_CORED =
- "xyz.openbmc_project.Dump.Internal.Create.Type.ApplicationCored";
+ constexpr auto DUMP_CREATE_IFACE = "xyz.openbmc_project.Dump.Create";
auto b = sdbusplus::bus::new_default();
auto mapper = b.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
MAPPER_INTERFACE, "GetObject");
- mapper.append(OBJ_INTERNAL, vector<string>({IFACE_INTERNAL}));
+ mapper.append(BMC_DUMP_OBJPATH, vector<string>({DUMP_CREATE_IFACE}));
map<string, vector<string>> mapperResponse;
try
@@ -79,9 +77,20 @@
}
const auto& host = mapperResponse.cbegin()->first;
- auto m = b.new_method_call(host.c_str(), OBJ_INTERNAL, IFACE_INTERNAL,
- "Create");
- m.append(APPLICATION_CORED, files);
+ auto m = b.new_method_call(host.c_str(), BMC_DUMP_OBJPATH,
+ DUMP_CREATE_IFACE, "CreateDump");
+ phosphor::dump::DumpCreateParams params;
+ using CreateParameters =
+ sdbusplus::common::xyz::openbmc_project::dump::Create::CreateParameters;
+ using DumpType =
+ sdbusplus::common::xyz::openbmc_project::dump::Create::DumpType;
+ using DumpIntr = sdbusplus::common::xyz::openbmc_project::dump::Create;
+ params[DumpIntr::convertCreateParametersToString(
+ CreateParameters::DumpType)] =
+ DumpIntr::convertDumpTypeToString(DumpType::ApplicationCored);
+ params[DumpIntr::convertCreateParametersToString(
+ CreateParameters::FilePath)] = files.front();
+ m.append(params);
try
{
b.call_noreply(m);
diff --git a/dump_types.cpp b/dump_types.cpp
index 539bca4..8dcdf15 100644
--- a/dump_types.cpp
+++ b/dump_types.cpp
@@ -11,11 +11,12 @@
{
DUMP_TYPE_TABLE dumpTypeTable = {
{"xyz.openbmc_project.Dump.Create.DumpType.UserRequested",
- {DumpTypes::USER, "BMC_DUMP"}}};
+ {DumpTypes::USER, "BMC_DUMP"}},
+ {"xyz.openbmc_project.Dump.Create.DumpType.ApplicationCored",
+ {DumpTypes::CORE, "BMC_DUMP"}}};
-DUMP_TYPE_TO_STRING_MAP dumpTypeToStringMap = {
- {DumpTypes::USER, "user"},
-};
+DUMP_TYPE_TO_STRING_MAP dumpTypeToStringMap = {{DumpTypes::USER, "user"},
+ {DumpTypes::CORE, "core"}};
std::optional<std::string> dumpTypeToString(const DumpTypes& dumpType)
{
diff --git a/dump_types.hpp b/dump_types.hpp
index be1e92d..38cef98 100644
--- a/dump_types.hpp
+++ b/dump_types.hpp
@@ -22,6 +22,7 @@
enum class DumpTypes
{
USER,
+ CORE,
};
// A table of dump types