OpenPower: Return unavailable if any error in deleting host dump
If there is a failure in sending dump delete request to host
for resource and system dump, return unavailable error.
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: Ia85ef46c55c5a2b54af2b8632f94c3318ef1d4d1
diff --git a/dump-extensions/openpower-dumps/system_dump_entry.cpp b/dump-extensions/openpower-dumps/system_dump_entry.cpp
index 2f44d34..39b161d 100644
--- a/dump-extensions/openpower-dumps/system_dump_entry.cpp
+++ b/dump-extensions/openpower-dumps/system_dump_entry.cpp
@@ -52,16 +52,27 @@
dumpId, srcDumpID)
.c_str());
- // 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()) && (srcDumpID != INVALID_SOURCE_ID))
{
- phosphor::dump::host::requestDelete(srcDumpID,
- TRANSPORT_DUMP_TYPE_IDENTIFIER);
+ try
+ {
+ phosphor::dump::host::requestDelete(srcDumpID,
+ TRANSPORT_DUMP_TYPE_IDENTIFIER);
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>(fmt::format("Error deleting dump from host id({}) "
+ "host id({}) error({})",
+ dumpId, srcDumpID, e.what())
+ .c_str());
+ elog<sdbusplus::xyz::openbmc_project::Common::Error::Unavailable>();
+ }
}
+
+ // Remove Dump entry D-bus object
+ phosphor::dump::Entry::delete_();
}
} // namespace system
} // namespace dump