Enable dump offload function to download all locally stored dumps
The request offload function passes absolute path to the
dump file. So no need to find the path using BMC_DUMP_PATH
and dump id. Removed that dependancy to enable any
locally stored dumps to use the common dump offload
function.
Tests:
Offloaded BMC dump successfully
Offloaded Hostboot dump successfully
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: Icbbfd0056d5afcb1c2d277a6f04a1a242f6a8fa8
diff --git a/dump_offload.cpp b/dump_offload.cpp
index 3c4b834..ada0e8a 100644
--- a/dump_offload.cpp
+++ b/dump_offload.cpp
@@ -145,10 +145,6 @@
using PathOpen = xyz::openbmc_project::Common::File::Open::PATH;
using ErrnoWrite = xyz::openbmc_project::Common::File::Write::ERRNO;
using PathWrite = xyz::openbmc_project::Common::File::Write::PATH;
- // open a dump file for a transfer.
- std::filesystem::path dumpPath(BMC_DUMP_PATH);
- dumpPath /= std::to_string(dumpId);
- dumpPath /= file.filename();
try
{
@@ -188,16 +184,16 @@
throw std::runtime_error(msg);
}
- std::ifstream infile{dumpPath, std::ios::in | std::ios::binary};
+ std::ifstream infile{file, std::ios::in | std::ios::binary};
if (!infile.good())
{
// Unable to open the dump file
log<level::ERR>(
fmt::format("Failed to open the dump from file, errno({}), "
"DUMPFILE({}), DUMP_ID({})",
- errno, dumpPath.c_str(), dumpId)
+ errno, file.c_str(), dumpId)
.c_str());
- elog<Open>(ErrnoOpen(errno), PathOpen(dumpPath.c_str()));
+ elog<Open>(ErrnoOpen(errno), PathOpen(file.c_str()));
}
infile.exceptions(std::ifstream::failbit | std::ifstream::badbit |
@@ -229,9 +225,9 @@
log<level::ERR>(
fmt::format(
"Failed to open, errormsg({}), OPENINTERFACE({}), DUMP_ID({})",
- oe.what(), dumpPath.c_str(), dumpId)
+ oe.what(), file.c_str(), dumpId)
.c_str());
- elog<Open>(ErrnoOpen(err), PathOpen(dumpPath.c_str()));
+ elog<Open>(ErrnoOpen(err), PathOpen(file.c_str()));
}
catch (const std::exception& e)
{