blob: 20610c74e8132d9eeda8410f430e7ed3107c910b [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
6#include <phosphor-logging/log.hpp>
7
8namespace phosphor
9{
10namespace dump
11{
12namespace bmc
13{
14using namespace phosphor::logging;
15
16void Entry::delete_()
17{
18 // Delete Dump file from Permanent location
19 try
20 {
Jayanth Othayoth3fc6df42021-04-08 03:45:24 -050021 std::filesystem::remove_all(file.parent_path());
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060022 }
Jayanth Othayoth3fc6df42021-04-08 03:45:24 -050023 catch (std::filesystem::filesystem_error& e)
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060024 {
25 // Log Error message and continue
26 log<level::ERR>(e.what());
27 }
28
29 // Remove Dump entry D-bus object
30 phosphor::dump::Entry::delete_();
31}
32
Dhruvaraj Subhashchandran580d91d2020-04-22 12:29:18 -050033void Entry::initiateOffload(std::string uri)
34{
35 phosphor::dump::offload::requestOffload(file, id, uri);
36 offloaded(true);
37}
38
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060039} // namespace bmc
40} // namespace dump
41} // namespace phosphor