1 #include "system_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 system 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 // Allow offloading only when the host is up. 24 if (!phosphor::dump::isHostRunning()) 25 { 26 elog<NotAllowed>( 27 Reason("System dump can be offloaded only when the host is up")); 28 return; 29 } 30 phosphor::dump::Entry::initiateOffload(uri); 31 phosphor::dump::host::requestOffload(sourceDumpId()); 32 } 33 34 void Entry::delete_() 35 { 36 auto srcDumpID = sourceDumpId(); 37 38 // Remove Dump entry D-bus object 39 phosphor::dump::Entry::delete_(); 40 41 // Remove host system dump when host is up by using source dump id 42 // which is present in system dump entry dbus object as a property. 43 if (phosphor::dump::isHostRunning()) 44 { 45 phosphor::dump::host::requestDelete(srcDumpID); 46 } 47 } 48 } // namespace system 49 } // namespace dump 50 } // namespace openpower 51