Make dump path dbus entry
Some applications need to offload the dump in
different ways, for example, do DMA transfer of the dump to
the host memory, such applications need the path and name
of the file to read from the BMC storage. Implement
/xyz/openbmc_project/Common/FilePath to store the
dump path.
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: If398940b655b4d90688273f0c76a20d4ead61992
diff --git a/bmc_dump_entry.cpp b/bmc_dump_entry.cpp
index 6bdb761..188d262 100644
--- a/bmc_dump_entry.cpp
+++ b/bmc_dump_entry.cpp
@@ -20,13 +20,15 @@
// Delete Dump file from Permanent location
try
{
- std::filesystem::remove_all(file.parent_path());
+ 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({})", e.what())
+ fmt::format("Failed to delete dump file({}), errormsg({})", path(),
+ e.what())
.c_str());
}
@@ -36,7 +38,7 @@
void Entry::initiateOffload(std::string uri)
{
- phosphor::dump::offload::requestOffload(file, id, uri);
+ phosphor::dump::offload::requestOffload(path(), id, uri);
offloaded(true);
}
diff --git a/bmc_dump_entry.hpp b/bmc_dump_entry.hpp
index 267a0ef..eb140e8 100644
--- a/bmc_dump_entry.hpp
+++ b/bmc_dump_entry.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "dump_entry.hpp"
+#include "xyz/openbmc_project/Common/FilePath/server.hpp"
#include "xyz/openbmc_project/Dump/Entry/BMC/server.hpp"
#include "xyz/openbmc_project/Dump/Entry/server.hpp"
#include "xyz/openbmc_project/Object/Delete/server.hpp"
@@ -21,7 +22,8 @@
using ServerObject = typename sdbusplus::server::object_t<T>;
using EntryIfaces = sdbusplus::server::object_t<
- sdbusplus::xyz::openbmc_project::Dump::Entry::server::BMC>;
+ sdbusplus::xyz::openbmc_project::Dump::Entry::server::BMC,
+ sdbusplus::xyz::openbmc_project::Common::server::FilePath>;
using originatorTypes = sdbusplus::xyz::openbmc_project::Common::server::
OriginatedBy::OriginatorTypes;
@@ -63,9 +65,9 @@
originatorTypes originatorType, phosphor::dump::Manager& parent) :
EntryIfaces(bus, objPath.c_str(), EntryIfaces::action::defer_emit),
phosphor::dump::Entry(bus, objPath.c_str(), dumpId, timeStamp, fileSize,
- status, originatorId, originatorType, parent),
- file(file)
+ status, originatorId, originatorType, parent)
{
+ path(file);
// Emit deferred signal.
this->phosphor::dump::bmc::EntryIfaces::emit_object_added();
}
@@ -93,15 +95,11 @@
size(fileSize);
// TODO: Handled dump failed case with #ibm-openbmc/2808
status(OperationStatus::Completed);
- file = filePath;
+ path(filePath);
// TODO: serialization of this property will be handled with
// #ibm-openbmc/2597
completedTime(timeStamp);
}
-
- private:
- /** @Dump file name */
- std::filesystem::path file;
};
} // namespace bmc