make bmc dump creation a utility function
Other parts of the code have a need for this function so put it in utils
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I223d9142e7d6ffe12ec3d59d42e848c2c859e3ce
diff --git a/systemd_target_signal.cpp b/systemd_target_signal.cpp
index 5bf40af..5f7036f 100644
--- a/systemd_target_signal.cpp
+++ b/systemd_target_signal.cpp
@@ -1,5 +1,7 @@
#include "systemd_target_signal.hpp"
+#include "utils.hpp"
+
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/exception.hpp>
@@ -19,26 +21,6 @@
using sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
-void SystemdTargetLogging::createBmcDump()
-{
- auto method = this->bus.new_method_call(
- "xyz.openbmc_project.Dump.Manager", "/xyz/openbmc_project/dump/bmc",
- "xyz.openbmc_project.Dump.Create", "CreateDump");
- method.append(
- std::vector<
- std::pair<std::string, std::variant<std::string, uint64_t>>>());
- try
- {
- this->bus.call_noreply(method);
- }
- catch (const sdbusplus::exception::exception& e)
- {
- error("Failed to create BMC dump, exception:{ERROR}", "ERROR", e);
- // just continue, this is error path anyway so we're just collecting
- // what we can
- }
-}
-
void SystemdTargetLogging::startBmcQuiesceTarget()
{
auto method = this->bus.new_method_call(
@@ -104,7 +86,7 @@
"UNIT", unit, "RESULT", result);
// Generate a BMC dump when a monitored target fails
- createBmcDump();
+ utils::createBmcDump(this->bus);
return (targetEntry->second.errorToLog);
}
}
@@ -120,7 +102,7 @@
"UNIT", unit, "RESULT", result);
// Generate a BMC dump when a critical service fails
- createBmcDump();
+ utils::createBmcDump(this->bus);
// Enter BMC Quiesce when a critical service fails
startBmcQuiesceTarget();
return (std::string{