blob: fe313d477e19ce6168c9734f155518bdc4069cb4 [file] [log] [blame]
Dhruvaraj Subhashchandran69e61522020-02-04 06:39:11 -06001#include "system_dump_entry.hpp"
2
Ramesh Iyyar22793862020-12-04 04:03:03 -06003#include "dump_utils.hpp"
Ramesh Iyyar131994b2020-12-03 08:35:36 -06004#include "host_transport_exts.hpp"
Dhruvaraj Subhashchandranad50d422022-01-18 05:54:02 -06005#include "op_dump_consts.hpp"
Dhruvaraj Subhashchandran69e61522020-02-04 06:39:11 -06006
Dhruvaraj Subhashchandranc1778da2022-02-04 01:46:49 -06007#include <fmt/core.h>
8
Dhruvaraj Subhashchandran6a54d9a2020-12-17 22:24:37 -06009#include <phosphor-logging/elog-errors.hpp>
10#include <xyz/openbmc_project/Common/error.hpp>
11
Dhruvaraj Subhashchandran341d6832021-01-15 06:28:04 -060012namespace openpower
Dhruvaraj Subhashchandran69e61522020-02-04 06:39:11 -060013{
14namespace dump
15{
16namespace system
17{
Dhruvaraj Subhashchandran4c63ce52020-12-18 02:07:22 -060018// TODO #ibm-openbmc/issues/2859
19// Revisit host transport impelementation
20// This value is used to identify the dump in the transport layer to host,
21constexpr auto TRANSPORT_DUMP_TYPE_IDENTIFIER = 3;
Dhruvaraj Subhashchandran6a54d9a2020-12-17 22:24:37 -060022using namespace phosphor::logging;
Dhruvaraj Subhashchandran69e61522020-02-04 06:39:11 -060023
24void Entry::initiateOffload(std::string uri)
25{
Dhruvaraj Subhashchandranc1778da2022-02-04 01:46:49 -060026 log<level::INFO>(
27 fmt::format(
28 "System dump offload request id({}) uri({}) source dumpid()", id,
29 uri, sourceDumpId())
30 .c_str());
Dhruvaraj Subhashchandran69e61522020-02-04 06:39:11 -060031 phosphor::dump::Entry::initiateOffload(uri);
Dhruvaraj Subhashchandran59642e22020-03-19 03:37:44 -050032 phosphor::dump::host::requestOffload(sourceDumpId());
Dhruvaraj Subhashchandran69e61522020-02-04 06:39:11 -060033}
34
Ramesh Iyyar22793862020-12-04 04:03:03 -060035void Entry::delete_()
36{
37 auto srcDumpID = sourceDumpId();
Dhruvaraj Subhashchandranc1778da2022-02-04 01:46:49 -060038 auto dumpId = id;
39 log<level::INFO>(fmt::format("System dump delete id({}) srcdumpid({})",
40 dumpId, srcDumpID)
41 .c_str());
Ramesh Iyyar22793862020-12-04 04:03:03 -060042
43 // Remove Dump entry D-bus object
44 phosphor::dump::Entry::delete_();
45
46 // Remove host system dump when host is up by using source dump id
47 // which is present in system dump entry dbus object as a property.
Dhruvaraj Subhashchandranad50d422022-01-18 05:54:02 -060048 if ((phosphor::dump::isHostRunning()) && (srcDumpID != INVALID_SOURCE_ID))
Ramesh Iyyar22793862020-12-04 04:03:03 -060049 {
Dhruvaraj Subhashchandran4c63ce52020-12-18 02:07:22 -060050 phosphor::dump::host::requestDelete(srcDumpID,
51 TRANSPORT_DUMP_TYPE_IDENTIFIER);
Ramesh Iyyar22793862020-12-04 04:03:03 -060052 }
53}
Dhruvaraj Subhashchandran69e61522020-02-04 06:39:11 -060054} // namespace system
55} // namespace dump
Dhruvaraj Subhashchandran341d6832021-01-15 06:28:04 -060056} // namespace openpower