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.
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
Change-Id: I9f91375788201e2badf51d87f8117154a8e1ed8a
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
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..82a61c2 100644
--- a/dump_manager_bmc.hpp
+++ b/dump_manager_bmc.hpp
@@ -2,8 +2,8 @@
#include "dump_manager.hpp"
#include "dump_utils.hpp"
+#include "errors_map.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 +17,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 +35,6 @@
virtual public CreateIface,
virtual public phosphor::dump::Manager
{
- friend class internal::Manager;
-
public:
Manager() = delete;
Manager(const Manager&) = default;
@@ -105,14 +87,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 bad1bad..af0ee16 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,9 +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::elog::Watch eWatch(bus, *bmcDumpMgr);
dumpMgrList.push_back(std::move(bmcDumpMgr));
diff --git a/elog_watch.cpp b/elog_watch.cpp
index d43ca48..b3ba0b6 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 "errors_map.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/elog_watch.hpp b/elog_watch.hpp
index 9fa270a..d8e6a8f 100644
--- a/elog_watch.hpp
+++ b/elog_watch.hpp
@@ -40,7 +40,7 @@
/** @brief constructs watch for elog add and delete signals.
* @param[in] bus - The Dbus bus object
- * @param[in] intMgr - Dump internal Manager object
+ * @param[in] mgr - Dump internal Manager object
*/
Watch(sdbusplus::bus_t& bus, Mgr& mgr);
diff --git a/meson.build b/meson.build
index 5e45557..47aaff4 100644
--- a/meson.build
+++ b/meson.build
@@ -122,8 +122,6 @@
configure_file(configuration : conf_data,
output : 'config.h'
)
-subdir('xyz/openbmc_project/Dump/Internal/Create')
-
python = find_program('python3')
errors_map_gen_file_loc = meson.project_source_root()
errors_map_gen_file_loc += '/errors_map_gen.py'
@@ -151,9 +149,6 @@
'dump_serialize.cpp',
'elog_watch.cpp',
errors_map_cpp,
- common_hpp,
- server_hpp,
- server_cpp,
'watch.cpp',
'bmc_dump_entry.cpp',
'dump_utils.cpp',
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'
- )