Dhruvaraj Subhashchandran | 62337a9 | 2020-11-22 21:24:30 -0600 | [diff] [blame] | 1 | #include "resource_dump_entry.hpp" |
| 2 | |
| 3 | #include "dump_utils.hpp" |
| 4 | #include "host_transport_exts.hpp" |
| 5 | |
| 6 | #include <phosphor-logging/elog-errors.hpp> |
| 7 | #include <xyz/openbmc_project/Common/error.hpp> |
| 8 | |
Dhruvaraj Subhashchandran | 341d683 | 2021-01-15 06:28:04 -0600 | [diff] [blame^] | 9 | namespace openpower |
Dhruvaraj Subhashchandran | 62337a9 | 2020-11-22 21:24:30 -0600 | [diff] [blame] | 10 | { |
| 11 | namespace dump |
| 12 | { |
| 13 | namespace resource |
| 14 | { |
| 15 | using namespace phosphor::logging; |
| 16 | |
| 17 | void Entry::initiateOffload(std::string uri) |
| 18 | { |
| 19 | using NotAllowed = |
| 20 | sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed; |
| 21 | using Reason = xyz::openbmc_project::Common::NotAllowed::REASON; |
| 22 | |
| 23 | if (!phosphor::dump::isHostRunning()) |
| 24 | { |
| 25 | elog<NotAllowed>( |
| 26 | Reason("This dump can be offloaded only when the host is up")); |
| 27 | return; |
| 28 | } |
| 29 | phosphor::dump::Entry::initiateOffload(uri); |
| 30 | phosphor::dump::host::requestOffload(sourceDumpId()); |
| 31 | } |
| 32 | |
| 33 | } // namespace resource |
| 34 | } // namespace dump |
Dhruvaraj Subhashchandran | 341d683 | 2021-01-15 06:28:04 -0600 | [diff] [blame^] | 35 | } // namespace openpower |