OpenPOWER: Prevent dump delete while offloading
Prevent the deletion of the dumps stored in host memory
while offload is in progress
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: I053d802a96548fdd9240cf21ef2bf91c4b38e367
diff --git a/dump-extensions/openpower-dumps/resource_dump_entry.cpp b/dump-extensions/openpower-dumps/resource_dump_entry.cpp
index 692ec14..40fa909 100644
--- a/dump-extensions/openpower-dumps/resource_dump_entry.cpp
+++ b/dump-extensions/openpower-dumps/resource_dump_entry.cpp
@@ -46,6 +46,19 @@
{
auto srcDumpID = sourceDumpId();
auto dumpId = id;
+
+ if ((!offloadUri().empty()) && (phosphor::dump::isHostRunning()))
+ {
+ log<level::ERR>(
+ fmt::format("Dump offload is in progress, cannot delete "
+ "dump, id({}) srcdumpid({})",
+ dumpId, srcDumpID)
+ .c_str());
+ elog<sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed>(
+ xyz::openbmc_project::Common::NotAllowed::REASON(
+ "Dump offload is in progress"));
+ }
+
log<level::INFO>(fmt::format("Resource dump delete id({}) srcdumpid({})",
dumpId, srcDumpID)
.c_str());
diff --git a/dump-extensions/openpower-dumps/system_dump_entry.cpp b/dump-extensions/openpower-dumps/system_dump_entry.cpp
index fe313d4..2f44d34 100644
--- a/dump-extensions/openpower-dumps/system_dump_entry.cpp
+++ b/dump-extensions/openpower-dumps/system_dump_entry.cpp
@@ -36,6 +36,18 @@
{
auto srcDumpID = sourceDumpId();
auto dumpId = id;
+
+ if ((!offloadUri().empty()) && (phosphor::dump::isHostRunning()))
+ {
+ log<level::ERR>(
+ fmt::format("Dump offload is in progress id({}) srcdumpid({})",
+ dumpId, srcDumpID)
+ .c_str());
+ elog<sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed>(
+ xyz::openbmc_project::Common::NotAllowed::REASON(
+ "Dump offload is in progress"));
+ }
+
log<level::INFO>(fmt::format("System dump delete id({}) srcdumpid({})",
dumpId, srcDumpID)
.c_str());