Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 1 | #include "bmc_dump_entry.hpp" |
| 2 | |
| 3 | #include "dump_manager.hpp" |
Dhruvaraj Subhashchandran | 580d91d | 2020-04-22 12:29:18 -0500 | [diff] [blame] | 4 | #include "dump_offload.hpp" |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 5 | |
George Liu | 858fbb2 | 2021-07-01 12:25:44 +0800 | [diff] [blame] | 6 | #include <fmt/core.h> |
| 7 | |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 8 | #include <phosphor-logging/log.hpp> |
| 9 | |
| 10 | namespace phosphor |
| 11 | { |
| 12 | namespace dump |
| 13 | { |
| 14 | namespace bmc |
| 15 | { |
| 16 | using namespace phosphor::logging; |
| 17 | |
| 18 | void Entry::delete_() |
| 19 | { |
| 20 | // Delete Dump file from Permanent location |
| 21 | try |
| 22 | { |
Jayanth Othayoth | 3fc6df4 | 2021-04-08 03:45:24 -0500 | [diff] [blame] | 23 | std::filesystem::remove_all(file.parent_path()); |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 24 | } |
Jayanth Othayoth | 3fc6df4 | 2021-04-08 03:45:24 -0500 | [diff] [blame] | 25 | catch (std::filesystem::filesystem_error& e) |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 26 | { |
| 27 | // Log Error message and continue |
George Liu | 858fbb2 | 2021-07-01 12:25:44 +0800 | [diff] [blame] | 28 | log<level::ERR>( |
| 29 | fmt::format("Failed to delete dump file, errormsg({})", e.what()) |
| 30 | .c_str()); |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | // Remove Dump entry D-bus object |
| 34 | phosphor::dump::Entry::delete_(); |
| 35 | } |
| 36 | |
Dhruvaraj Subhashchandran | 580d91d | 2020-04-22 12:29:18 -0500 | [diff] [blame] | 37 | void Entry::initiateOffload(std::string uri) |
| 38 | { |
| 39 | phosphor::dump::offload::requestOffload(file, id, uri); |
| 40 | offloaded(true); |
| 41 | } |
| 42 | |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 43 | } // namespace bmc |
| 44 | } // namespace dump |
| 45 | } // namespace phosphor |