blob: f950c5d9278607d278b49a1a50d51078d5a01ce1 [file] [log] [blame]
#include "system_dump_entry.hpp"
#include "dump_utils.hpp"
#include "host_transport_exts.hpp"
#include <phosphor-logging/elog-errors.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
namespace openpower
{
namespace dump
{
namespace system
{
using namespace phosphor::logging;
void Entry::initiateOffload(std::string uri)
{
using NotAllowed =
sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed;
using Reason = xyz::openbmc_project::Common::NotAllowed::REASON;
// Allow offloading only when the host is up.
if (!phosphor::dump::isHostRunning())
{
elog<NotAllowed>(
Reason("System dump can be offloaded only when the host is up"));
return;
}
phosphor::dump::Entry::initiateOffload(uri);
phosphor::dump::host::requestOffload(sourceDumpId());
}
void Entry::delete_()
{
auto srcDumpID = sourceDumpId();
// Remove Dump entry D-bus object
phosphor::dump::Entry::delete_();
// Remove host system dump when host is up by using source dump id
// which is present in system dump entry dbus object as a property.
if (phosphor::dump::isHostRunning())
{
phosphor::dump::host::requestDelete(srcDumpID);
}
}
} // namespace system
} // namespace dump
} // namespace openpower