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 9 namespace openpower 10 { 11 namespace dump 12 { 13 namespace resource 14 { 15 // TODO #ibm-openbmc/issues/2859 16 // Revisit host transport impelementation 17 // This value is used to identify the dump in the transport layer to host, 18 constexpr auto TRANSPORT_DUMP_TYPE_IDENTIFIER = 9; 19 using namespace phosphor::logging; 20 21 void Entry::initiateOffload(std::string uri) 22 { 23 using NotAllowed = 24 sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed; 25 using Reason = xyz::openbmc_project::Common::NotAllowed::REASON; 26 27 if (!phosphor::dump::isHostRunning()) 28 { 29 elog<NotAllowed>( 30 Reason("This dump can be offloaded only when the host is up")); 31 return; 32 } 33 phosphor::dump::Entry::initiateOffload(uri); 34 phosphor::dump::host::requestOffload(sourceDumpId()); 35 } 36 37 void Entry::delete_() 38 { 39 auto srcDumpID = sourceDumpId(); 40 41 // Remove Dump entry D-bus object 42 phosphor::dump::Entry::delete_(); 43 44 // Remove resource dump when host is up by using source dump id 45 // which is present in resource dump entry dbus object as a property. 46 if (phosphor::dump::isHostRunning()) 47 { 48 phosphor::dump::host::requestDelete(srcDumpID, 49 TRANSPORT_DUMP_TYPE_IDENTIFIER); 50 } 51 } 52 } // namespace resource 53 } // namespace dump 54 } // namespace openpower 55