-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdump_manager_faultlog.hpp
85 lines (73 loc) · 2.43 KB
/
dump_manager_faultlog.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#pragma once
#include "dump_manager.hpp"
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/elog.hpp>
#include <phosphor-logging/lg2.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>
#include <xyz/openbmc_project/Dump/Create/server.hpp>
namespace phosphor
{
namespace dump
{
namespace faultlog
{
using CreateIface = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Dump::server::Create>;
/** @class Manager
* @brief FaultLog Dump manager implementation.
*/
class Manager :
virtual public CreateIface,
virtual public phosphor::dump::Manager
{
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] path - Path to attach at.
* @param[in] baseEntryPath - Base path for dump entry.
* @param[in] filePath - Path where the dumps are stored.
*/
Manager(sdbusplus::bus_t& bus, const char* path,
const std::string& baseEntryPath, const char* filePath) :
CreateIface(bus, path),
phosphor::dump::Manager(bus, path, baseEntryPath), dumpDir(filePath)
{
std::error_code ec;
std::filesystem::create_directory(FAULTLOG_DUMP_PATH, ec);
if (ec)
{
auto dir = FAULTLOG_DUMP_PATH;
lg2::error(
"dump_manager_faultlog directory {DIRECTORY} not created. "
"error_code = {ERRNO} ({ERROR_MESSAGE})",
"DIRECTORY", dir, "ERRNO", ec.value(), "ERROR_MESSAGE",
ec.message());
}
}
void restore() override
{
// TODO phosphor-debug-collector/issues/21: Restore fault log entries
// after service restart
lg2::info("dump_manager_faultlog restore not implemented");
}
/** @brief Method to create a new fault log dump entry
* @param[in] params - Key-value pair input parameters
*
* @return object_path - The path to the new dump entry.
*/
sdbusplus::message::object_path
createDump(phosphor::dump::DumpCreateParams params) override;
private:
/** @brief Path to the dump file*/
std::string dumpDir;
};
} // namespace faultlog
} // namespace dump
} // namespace phosphor