Refactor BMC dump entry to accomodate more locally stored dumps
Split the BMC dump entry to a base class bmc_stored::Manager
and bmc::Manager. All the functions common to the all BMC
stored dumps are kept in the new base class
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: Ibe2e2a7bf6f92bac1aec174cfe998b6363a6c9f8
diff --git a/bmcstored_dump_entry.cpp b/bmcstored_dump_entry.cpp
new file mode 100644
index 0000000..302fd43
--- /dev/null
+++ b/bmcstored_dump_entry.cpp
@@ -0,0 +1,46 @@
+#include "bmc_dump_entry.hpp"
+#include "dump_manager.hpp"
+#include "dump_offload.hpp"
+
+#include <fmt/core.h>
+
+#include <phosphor-logging/log.hpp>
+
+namespace phosphor
+{
+namespace dump
+{
+namespace bmc_stored
+{
+using namespace phosphor::logging;
+
+void Entry::delete_()
+{
+ // Delete Dump file from Permanent location
+ try
+ {
+ std::filesystem::remove_all(
+ std::filesystem::path(path()).parent_path());
+ }
+ catch (const std::filesystem::filesystem_error& e)
+ {
+ // Log Error message and continue
+ log<level::ERR>(
+ fmt::format("Failed to delete dump file({}), errormsg({})", path(),
+ e.what())
+ .c_str());
+ }
+
+ // Remove Dump entry D-bus object
+ phosphor::dump::Entry::delete_();
+}
+
+void Entry::initiateOffload(std::string uri)
+{
+ phosphor::dump::offload::requestOffload(path(), id, uri);
+ offloaded(true);
+}
+
+} // namespace bmc_stored
+} // namespace dump
+} // namespace phosphor