Remove internal dump create interface
The createDump method was revised to support key-value parameters,
allowing flexible dump type specification. This change negates the need
for the internal create interface, exclusive to the
phosphor-debug-collector repository.
This commit removes all instances of the internal create method,
replacing them with the updated createDump method. The modified
createDump approach ensures a consistent dump initiation procedure
and enables all applications to request various dump types.
Manual Tests:
- Validate the creation of a user-requested BMC dump.
- Validate the creation of a dump due to an InternalFailure.
- Generate a core dump to validate the corresponding BMC dump creation.
- Ensure that system-generated dumps are allowed when user-requested
dump is in progress.
- Ensure simultaneous user requested dumps are prevented
Checkstop dump
busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging \
xyz.openbmc_project.Logging.Create Create ssa{ss} \
org.open_power.Host.Boot.Error.Checkstop \
xyz.openbmc_project.Logging.Entry.Level.Error 0
Logs:
Initiating new BMC dump with type: checkstop path: /xyz/openbmc_\
project/logging/entry/78
performing dump compression /tmp/BMCDUMP.XX.0000003.20230724015349
Report is available in /var/lib/phosphor-debug-collector/dumps/3
Automated tests:
Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
Create_Two_User_Initiated_BMC_Dumps
Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
Delete_All_User_Initiated_BMC_Dumps_And_Verify
Delete_User_Initiated_BMC_Dump_And_Verify
Verify_BMC_Core_Dump_When_Host_Powered_Off
Verify_BMC_Dump_Create_Errors_While_Another_BMC_Dump_In_Progress
Verify_BMC_Dump_Default_Location_In_BMC
Verify_Core_Dump_Size
Verify_Core_Watchdog_Initiated_BMC_Dump
Verify_Dump_Persistency_On_BMC_Reset
Verify_Dump_Persistency_On_Dump_Service_Restart
Verify_Error_Log_And_Dump_For_Internal_Failure
Verify_Error_Response_For_Already_Deleted_Dump_Id
Verify_Error_While_Initiating_BMC_Dump_During_Dumping_State
Verify_Internal_Failure_Initiated_BMC_Dump_Size
Verify_Multiple_BMC_Dump_Creation
Verify_User_Initiated_BMC_Dump_At_Host_Booting
Verify_User_Initiated_BMC_Dump_Size
Verify_User_Initiated_BMC_Dump_When_Host_Booted
Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off
Built with master and p10bmc
Change-Id: I9f91375788201e2badf51d87f8117154a8e1ed8a
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
diff --git a/core_manager.cpp b/core_manager.cpp
index a2219c3..176c0bd 100644
--- a/core_manager.cpp
+++ b/core_manager.cpp
@@ -67,7 +67,7 @@
}
catch (const sdbusplus::exception_t& e)
{
- lg2::error("Failed to GetObject on Dump.Internal: {ERROR}", "ERROR", e);
+ lg2::error("Failed to GetObject on Dump.Create: {ERROR}", "ERROR", e);
return;
}
if (mapperResponse.empty())
diff --git a/core_manager.hpp b/core_manager.hpp
index ee887ed..6c7457c 100644
--- a/core_manager.hpp
+++ b/core_manager.hpp
@@ -55,7 +55,7 @@
private:
/** @brief Helper function for initiating dump request using
- * D-bus internal create interface.
+ * createDump D-Bus interface.
* @param [in] files - Core files list
*/
void createHelper(const std::vector<std::string>& files);
diff --git a/dump_internal.hpp b/dump_internal.hpp
deleted file mode 100644
index 7bd69cb..0000000
--- a/dump_internal.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-#pragma once
-
-#include "xyz/openbmc_project/Dump/Internal/Create/server.hpp"
-
-#include <sdbusplus/bus.hpp>
-#include <sdbusplus/server/object.hpp>
-
-namespace phosphor
-{
-namespace dump
-{
-namespace bmc
-{
-
-class Manager;
-namespace internal
-{
-
-using CreateIface = sdbusplus::server::object_t<
- sdbusplus::xyz::openbmc_project::Dump::Internal::server::Create>;
-using Mgr = phosphor::dump::bmc::Manager;
-
-/** @class Manager
- * @brief Implementation for the
- * xyz.openbmc_project.Dump.Internal.Create DBus API.
- */
-class Manager : public CreateIface
-{
- public:
- Manager() = delete;
- Manager(const Manager&) = delete;
- Manager& operator=(const Manager&) = delete;
- Manager(Manager&&) = delete;
- Manager& operator=(Manager&&) = delete;
- virtual ~Manager() = default;
-
- /** @brief Constructor to put object onto bus at a dbus path.
- * @param[in] bus - Bus to attach to.
- * @param[in] dumpMgr - Dump Manager object
- * @param[in] path - Path to attach at.
- */
- Manager(sdbusplus::bus_t& bus, Mgr& dumpMgr, const char* path) :
- CreateIface(bus, path), dumpMgr(dumpMgr){};
-
- /** @brief Implementation for Create
- * Create BMC Dump based on the Dump type.
- *
- * @param[in] type - Type of the Dump.
- * @param[in] fullPaths - List of absolute paths to the files
- * to be included as part of Dump package.
- */
- void create(Type type, std::vector<std::string> fullPaths) override;
-
- private:
- /** @brief Dump Manager object. */
- Mgr& dumpMgr;
-};
-
-} // namespace internal
-} // namespace bmc
-} // namespace dump
-} // namespace phosphor
diff --git a/dump_manager_bmc.cpp b/dump_manager_bmc.cpp
index d41979a..68d0759 100644
--- a/dump_manager_bmc.cpp
+++ b/dump_manager_bmc.cpp
@@ -3,7 +3,6 @@
#include "dump_manager_bmc.hpp"
#include "bmc_dump_entry.hpp"
-#include "dump_internal.hpp"
#include "dump_types.hpp"
#include "xyz/openbmc_project/Common/error.hpp"
#include "xyz/openbmc_project/Dump/Create/error.hpp"
@@ -34,16 +33,6 @@
bool Manager::fUserDumpInProgress = false;
constexpr auto BMC_DUMP = "BMC_DUMP";
-namespace internal
-{
-
-void Manager::create(Type type, std::vector<std::string> fullPaths)
-{
- dumpMgr.phosphor::dump::bmc::Manager::captureDump(type, fullPaths);
-}
-
-} // namespace internal
-
sdbusplus::message::object_path
Manager::createDump(phosphor::dump::DumpCreateParams params)
{
@@ -58,7 +47,6 @@
phosphor::dump::extractOriginatorProperties(params, originatorId,
originatorType);
-
using CreateParameters =
sdbusplus::common::xyz::openbmc_project::dump::Create::CreateParameters;
@@ -119,14 +107,6 @@
return objPath.string();
}
-uint32_t Manager::captureDump(Type type,
- const std::vector<std::string>& fullPaths)
-{
- // get dreport type map entry
- auto tempType = TypeMap.find(type);
- return captureDump(stringToDumpType(tempType->second).value(),
- fullPaths.front());
-}
uint32_t Manager::captureDump(DumpTypes type, const std::string& path)
{
// Get Dump size.
diff --git a/dump_manager_bmc.hpp b/dump_manager_bmc.hpp
index 22e688d..1e4e586 100644
--- a/dump_manager_bmc.hpp
+++ b/dump_manager_bmc.hpp
@@ -3,7 +3,6 @@
#include "dump_manager.hpp"
#include "dump_utils.hpp"
#include "watch.hpp"
-#include "xyz/openbmc_project/Dump/Internal/Create/server.hpp"
#include <sdeventplus/source/child.hpp>
#include <xyz/openbmc_project/Dump/Create/server.hpp>
@@ -17,30 +16,14 @@
{
namespace bmc
{
-namespace internal
-{
-
-class Manager;
-
-} // namespace internal
using CreateIface = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Dump::server::Create>;
using UserMap = phosphor::dump::inotify::UserMap;
-using Type =
- sdbusplus::xyz::openbmc_project::Dump::Internal::server::Create::Type;
-
using Watch = phosphor::dump::inotify::Watch;
using ::sdeventplus::source::Child;
-// Type to dreport type string map
-static const std::map<Type, std::string> TypeMap = {
- {Type::ApplicationCored, "core"},
- {Type::UserRequested, "user"},
- {Type::InternalFailure, "elog"},
- {Type::Checkstop, "checkstop"},
- {Type::Ramoops, "ramoops"}};
/** @class Manager
* @brief OpenBMC Dump manager implementation.
@@ -51,8 +34,6 @@
virtual public CreateIface,
virtual public phosphor::dump::Manager
{
- friend class internal::Manager;
-
public:
Manager() = delete;
Manager(const Manager&) = default;
@@ -105,14 +86,6 @@
*/
void createEntry(const std::filesystem::path& fullPath);
- /** @brief Capture BMC Dump based on the Dump type.
- * @param[in] type - Type of the Dump.
- * @param[in] fullPaths - List of absolute paths to the files
- * to be included as part of Dump package.
- * @return id - The Dump entry id number.
- */
- uint32_t captureDump(Type type, const std::vector<std::string>& fullPaths);
-
/** @brief Capture BMC Dump based on the Dump type.
* @param[in] type - Type of the dump to pass to dreport
* @param[in] path - An absolute path to the file
diff --git a/dump_manager_main.cpp b/dump_manager_main.cpp
index 4801f5f..a3ce920 100644
--- a/dump_manager_main.cpp
+++ b/dump_manager_main.cpp
@@ -1,7 +1,6 @@
#include "config.h"
#include "dump-extensions.hpp"
-#include "dump_internal.hpp"
#include "dump_manager.hpp"
#include "dump_manager_bmc.hpp"
#include "dump_manager_faultlog.hpp"
@@ -69,8 +68,6 @@
bus, eventP, BMC_DUMP_OBJPATH, BMC_DUMP_OBJ_ENTRY,
BMC_DUMP_PATH);
- phosphor::dump::bmc::internal::Manager mgr(bus, *bmcDumpMgr,
- OBJ_INTERNAL);
phosphor::dump::bmc::Manager* ptrBmcDumpMgr = bmcDumpMgr.get();
dumpMgrList.push_back(std::move(bmcDumpMgr));
diff --git a/elog_watch.cpp b/elog_watch.cpp
index d128f12..4eb39f2 100644
--- a/elog_watch.cpp
+++ b/elog_watch.cpp
@@ -2,7 +2,6 @@
#include "elog_watch.hpp"
-#include "dump_internal.hpp"
#include "dump_serialize.hpp"
#include "dump_types.hpp"
#include "xyz/openbmc_project/Dump/Create/error.hpp"
@@ -11,6 +10,7 @@
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/exception.hpp>
+#include <xyz/openbmc_project/Dump/Create/common.hpp>
#include <fstream>
diff --git a/meson.build b/meson.build
index f7acc64..98ce6d0 100644
--- a/meson.build
+++ b/meson.build
@@ -72,9 +72,6 @@
conf_data.set_quoted('CORE_FILE_DIR', get_option('CORE_FILE_DIR'),
description : 'Directory where core dumps are placed'
)
-conf_data.set_quoted('OBJ_INTERNAL', get_option('OBJ_INTERNAL'),
- description : 'Internal Dump manager Dbus object path'
- )
conf_data.set_quoted('BMC_DUMP_OBJ_ENTRY', get_option('BMC_DUMP_OBJ_ENTRY'),
description : 'The BMC dump entry DBus object path'
)
@@ -122,7 +119,6 @@
configure_file(configuration : conf_data,
output : 'config.h'
)
-subdir('xyz/openbmc_project/Dump/Internal/Create')
dump_types_yaml_files = []
@@ -199,9 +195,6 @@
'dump_manager_main.cpp',
'dump_serialize.cpp',
'elog_watch.cpp',
- common_hpp,
- server_hpp,
- server_cpp,
dump_types_hpp,
dump_types_cpp,
'watch.cpp',
diff --git a/meson.options b/meson.options
index 0fe8e95..012a167 100644
--- a/meson.options
+++ b/meson.options
@@ -26,11 +26,6 @@
description : 'Directory where core dumps are placed'
)
-option('OBJ_INTERNAL', type : 'string',
- value : '/xyz/openbmc_project/dump/internal/manager',
- description : 'Internal dump manager D-Bus object path'
- )
-
option('BMC_DUMP_OBJ_ENTRY', type : 'string',
value : '/xyz/openbmc_project/dump/bmc/entry',
description : 'The BMC dump entry D-Bus object path'
diff --git a/ramoops_manager.hpp b/ramoops_manager.hpp
index 3946a2b..57ab23c 100644
--- a/ramoops_manager.hpp
+++ b/ramoops_manager.hpp
@@ -35,7 +35,7 @@
private:
/** @brief Helper function for initiating dump request using
- * D-bus internal create interface.
+ * createDump D-Bus interface.
* @param [in] files - ramoops files list
*/
void createHelper(const std::vector<std::string>& files);
diff --git a/xyz/openbmc_project/Dump/Internal/Create.interface.yaml b/xyz/openbmc_project/Dump/Internal/Create.interface.yaml
deleted file mode 100644
index e2984c2..0000000
--- a/xyz/openbmc_project/Dump/Internal/Create.interface.yaml
+++ /dev/null
@@ -1,44 +0,0 @@
-description: >
- Implement to capture BMC Dump based on type.
-
-methods:
- - name: Create
- description: >
- Create BMC Dump based on the Dump type.
- parameters:
- - name: Type
- type: enum[self.Type]
- description: >
- Type of the Dump.
- - name: FullPaths
- type: array[string]
- description: >
- A list of paths (file paths or d-bus object paths) that must be
- processed to derive the dump content.
- errors:
- - xyz.openbmc_project.Common.File.Error.Write
- - xyz.openbmc_project.Dump.Create.Error.Disabled
- - xyz.openbmc_project.Dump.Create.Error.QuotaExceeded
-
-enumerations:
- - name: Type
- description: >
- Possible types of BMC Dump.
- values:
- - name: ApplicationCored
- description: >
- Dump triggered due to application core.
- - name: UserRequested
- description: >
- Dump triggered by the user.
- - name: InternalFailure
- description: >
- Dump triggered due to InternalFailure type error commit.
- - name: Checkstop
- description: >
- Dump triggered due to Checkstop type error commit.
- - name: Ramoops
- description: >
- Dump triggered due to Ramoops type error commit.
-
-# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
diff --git a/xyz/openbmc_project/Dump/Internal/Create/meson.build b/xyz/openbmc_project/Dump/Internal/Create/meson.build
deleted file mode 100644
index f2d2c45..0000000
--- a/xyz/openbmc_project/Dump/Internal/Create/meson.build
+++ /dev/null
@@ -1,46 +0,0 @@
-# SPDX-License-Identifier: Apache-2.0
-
-common_hpp = custom_target(
- 'common.hpp',
- command : [
- sdbusplusplus_prog, '-r', meson.project_source_root(),
- 'interface',
- 'common-header',
- 'xyz.openbmc_project.Dump.Internal.Create',
- ],
- input : '../Create.interface.yaml',
- capture : true,
- output : 'common.hpp',
- install : true,
- install_dir: get_option('includedir') / 'xyz/openbmc_project/Dump/Internal/Create'
- )
-
-server_hpp = custom_target(
- 'server.hpp',
- command : [
- sdbusplusplus_prog, '-r', meson.project_source_root(),
- 'interface',
- 'server-header',
- 'xyz.openbmc_project.Dump.Internal.Create',
- ],
- input : '../Create.interface.yaml',
- depends: common_hpp,
- capture : true,
- output : 'server.hpp',
- install : true,
- install_dir: get_option('includedir') / 'xyz/openbmc_project/Dump/Internal/Create'
- )
-
-server_cpp = custom_target(
- 'server.cpp',
- command : [
- sdbusplusplus_prog, '-r', meson.project_source_root(),
- 'interface',
- 'server-cpp',
- 'xyz.openbmc_project.Dump.Internal.Create'
- ],
- input : '../Create.interface.yaml',
- depends : server_hpp,
- capture : true,
- output : 'server.cpp'
- )