pseq: Add BMC dump method to Services class
Add a method to the Services class to create a BMC dump.
Tested:
* Delete all BMC dumps on system
* Verify no BMC dumps exist
* Call method to create a BMC dump
* Verify dump is created
* Expand dump
* Verify dump has expected contents
* Call method to create a BMC dump again
* Verify a second dump is created
Change-Id: Ia4b9753e9ba15ed61bf5446006713875e738b3dd
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/phosphor-power-sequencer/src/services.cpp b/phosphor-power-sequencer/src/services.cpp
index 9c9ace7..5078be1 100644
--- a/phosphor-power-sequencer/src/services.cpp
+++ b/phosphor-power-sequencer/src/services.cpp
@@ -25,6 +25,7 @@
#include <gpiod.hpp>
#include <exception>
+#include <variant>
namespace phosphor::power::sequencer
{
@@ -150,4 +151,22 @@
return isExpected;
}
+void BMCServices::createBMCDump()
+{
+ try
+ {
+ auto method = 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>>>());
+ bus.call_noreply(method);
+ }
+ catch (const std::exception& e)
+ {
+ lg2::error("Unable to create BMC dump: {ERROR}", "ERROR", e);
+ }
+}
+
} // namespace phosphor::power::sequencer
diff --git a/phosphor-power-sequencer/src/services.hpp b/phosphor-power-sequencer/src/services.hpp
index 255e2c5..3fa0f6f 100644
--- a/phosphor-power-sequencer/src/services.hpp
+++ b/phosphor-power-sequencer/src/services.hpp
@@ -128,6 +128,11 @@
size_t instance = 0) = 0;
/**
+ * Creates a BMC dump.
+ */
+ virtual void createBMCDump() = 0;
+
+ /**
* Clear any cached data.
*
* Some data may be cached for performance reasons, such as hardware
@@ -201,6 +206,9 @@
return std::make_unique<PMBus>(path, driverName, instance);
}
+ /** @copydoc Services::createBMCDump() */
+ virtual void createBMCDump() override;
+
/** @copydoc Services::clearCache() */
virtual void clearCache() override
{