blob: 6bdb761a497375e8646a0b7f7681f40465d8c9d0 [file] [log] [blame]
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -06001#include "bmc_dump_entry.hpp"
2
3#include "dump_manager.hpp"
Dhruvaraj Subhashchandran580d91d2020-04-22 12:29:18 -05004#include "dump_offload.hpp"
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -06005
George Liu858fbb22021-07-01 12:25:44 +08006#include <fmt/core.h>
7
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -06008#include <phosphor-logging/log.hpp>
9
10namespace phosphor
11{
12namespace dump
13{
14namespace bmc
15{
16using namespace phosphor::logging;
17
18void Entry::delete_()
19{
20 // Delete Dump file from Permanent location
21 try
22 {
Jayanth Othayoth3fc6df42021-04-08 03:45:24 -050023 std::filesystem::remove_all(file.parent_path());
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060024 }
Patrick Williams9d2d7222021-10-06 12:44:44 -050025 catch (const std::filesystem::filesystem_error& e)
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060026 {
27 // Log Error message and continue
George Liu858fbb22021-07-01 12:25:44 +080028 log<level::ERR>(
29 fmt::format("Failed to delete dump file, errormsg({})", e.what())
30 .c_str());
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060031 }
32
33 // Remove Dump entry D-bus object
34 phosphor::dump::Entry::delete_();
35}
36
Dhruvaraj Subhashchandran580d91d2020-04-22 12:29:18 -050037void Entry::initiateOffload(std::string uri)
38{
39 phosphor::dump::offload::requestOffload(file, id, uri);
40 offloaded(true);
41}
42
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060043} // namespace bmc
44} // namespace dump
45} // namespace phosphor