blob: efbb7581708f6702a036a76583b3e115355db59f [file] [log] [blame]
Dhruvaraj Subhashchandran62337a92020-11-22 21:24:30 -06001#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 Subhashchandran341d6832021-01-15 06:28:04 -06009namespace openpower
Dhruvaraj Subhashchandran62337a92020-11-22 21:24:30 -060010{
11namespace dump
12{
13namespace resource
14{
15using namespace phosphor::logging;
16
17void 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 Subhashchandran341d6832021-01-15 06:28:04 -060035} // namespace openpower