Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 1 | #include "bmc_dump_entry.hpp" |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 2 | #include "dump_manager.hpp" |
Dhruvaraj Subhashchandran | 580d91d | 2020-04-22 12:29:18 -0500 | [diff] [blame] | 3 | #include "dump_offload.hpp" |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 4 | |
George Liu | 858fbb2 | 2021-07-01 12:25:44 +0800 | [diff] [blame] | 5 | #include <fmt/core.h> |
| 6 | |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 7 | #include <phosphor-logging/log.hpp> |
| 8 | |
| 9 | namespace phosphor |
| 10 | { |
| 11 | namespace dump |
| 12 | { |
Dhruvaraj Subhashchandran | 860b8a3 | 2021-05-05 13:01:49 -0500 | [diff] [blame] | 13 | namespace bmc_stored |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 14 | { |
| 15 | using namespace phosphor::logging; |
| 16 | |
| 17 | void Entry::delete_() |
| 18 | { |
| 19 | // Delete Dump file from Permanent location |
| 20 | try |
| 21 | { |
Dhruvaraj Subhashchandran | 9420f48 | 2021-12-08 03:48:23 -0600 | [diff] [blame] | 22 | std::filesystem::remove_all( |
| 23 | std::filesystem::path(path()).parent_path()); |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 24 | } |
Patrick Williams | 9d2d722 | 2021-10-06 12:44:44 -0500 | [diff] [blame] | 25 | catch (const 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>( |
Dhruvaraj Subhashchandran | 9420f48 | 2021-12-08 03:48:23 -0600 | [diff] [blame] | 29 | fmt::format("Failed to delete dump file({}), errormsg({})", path(), |
| 30 | e.what()) |
George Liu | 858fbb2 | 2021-07-01 12:25:44 +0800 | [diff] [blame] | 31 | .c_str()); |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | // Remove Dump entry D-bus object |
| 35 | phosphor::dump::Entry::delete_(); |
| 36 | } |
| 37 | |
Dhruvaraj Subhashchandran | 580d91d | 2020-04-22 12:29:18 -0500 | [diff] [blame] | 38 | void Entry::initiateOffload(std::string uri) |
| 39 | { |
Dhruvaraj Subhashchandran | 9420f48 | 2021-12-08 03:48:23 -0600 | [diff] [blame] | 40 | phosphor::dump::offload::requestOffload(path(), id, uri); |
Dhruvaraj Subhashchandran | 580d91d | 2020-04-22 12:29:18 -0500 | [diff] [blame] | 41 | offloaded(true); |
| 42 | } |
| 43 | |
Dhruvaraj Subhashchandran | 860b8a3 | 2021-05-05 13:01:49 -0500 | [diff] [blame] | 44 | } // namespace bmc_stored |
Dhruvaraj Subhashchandran | 4a98e8f | 2020-01-29 07:11:08 -0600 | [diff] [blame] | 45 | } // namespace dump |
| 46 | } // namespace phosphor |