blob: a75606dae22c4915da1987941a646a3655a220c2 [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
Dhruvaraj Subhashchandrand1f670f2023-06-05 22:19:25 -05006#include <phosphor-logging/lg2.hpp>
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -06007
8namespace phosphor
9{
10namespace dump
11{
12namespace bmc
13{
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060014
15void Entry::delete_()
16{
17 // Delete Dump file from Permanent location
18 try
19 {
Jayanth Othayoth3fc6df42021-04-08 03:45:24 -050020 std::filesystem::remove_all(file.parent_path());
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060021 }
Patrick Williams9d2d7222021-10-06 12:44:44 -050022 catch (const std::filesystem::filesystem_error& e)
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060023 {
24 // Log Error message and continue
Dhruvaraj Subhashchandrand1f670f2023-06-05 22:19:25 -050025 lg2::error("Failed to delete dump file, errormsg: {ERROR}", "ERROR", e);
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060026 }
27
28 // Remove Dump entry D-bus object
29 phosphor::dump::Entry::delete_();
30}
31
Dhruvaraj Subhashchandran580d91d2020-04-22 12:29:18 -050032void Entry::initiateOffload(std::string uri)
33{
34 phosphor::dump::offload::requestOffload(file, id, uri);
35 offloaded(true);
36}
37
Dhruvaraj Subhashchandran4a98e8f2020-01-29 07:11:08 -060038} // namespace bmc
39} // namespace dump
40} // namespace phosphor