Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nag #169

Open
wants to merge 3 commits into
base: 1110
Choose a base branch
from
Open

Nag #169

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .shellcheck-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ tools/dreport.d/plugins.d/traceevents
tools/dreport.d/plugins.d/top
tools/dreport.d/plugins.d/uptime
tools/dreport.d/ibm.d/plugins.d/badpel
tools/dreport.d/openpower.d/plugins.d/hostboot
tools/dreport.d/ibm.d/plugins.d/faultlog
46 changes: 41 additions & 5 deletions dump_manager_bmc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,16 @@ constexpr auto BMC_DUMP = "BMC_DUMP";
sdbusplus::message::object_path
Manager::createDump(phosphor::dump::DumpCreateParams params)
{
if (params.size() > CREATE_DUMP_MAX_PARAMS)
if (params.size() > CREATE_BMC_DUMP_MAX_PARAMS)
{
lg2::warning("BMC dump accepts not more than 2 additional parameters");
}

if (Manager::fUserDumpInProgress == true)
{
elog<sdbusplus::xyz::openbmc_project::Common::Error::Unavailable>();
}

// Get the originator id and type from params
std::string originatorId;
originatorTypes originatorType;
Expand All @@ -62,18 +67,48 @@ sdbusplus::message::object_path
{
dumpType = getErrorDumpType(params);
}
std::string path = extractParameter<std::string>(

#ifdef FAULT_DATA_DUMP
constexpr auto BMC_DUMP_TYPE =
"xyz.openbmc_project.Dump.Internal.Create.Type";
constexpr auto FAULT_DATA_DUMP_TYPE =
"xyz.openbmc_project.Dump.Internal.Create.Type.FaultData";
using InvalidArgument =
sdbusplus::xyz::openbmc_project::Common::Error::InvalidArgument;
using Argument = xyz::openbmc_project::Common::InvalidArgument;
auto iter = params.find(BMC_DUMP_TYPE);
if (iter != params.end())
{
if (!std::holds_alternative<std::string>(iter->second))
{
lg2::error("An invalid dump type passed");
elog<InvalidArgument>(Argument::ARGUMENT_NAME("BMC_DUMP_TYPE"),
Argument::ARGUMENT_VALUE("INVALID INPUT"));
}

auto strDumpType = std::get<std::string>(iter->second);
// Only Fault data dump is supported
if (strDumpType != FAULT_DATA_DUMP_TYPE)
{
lg2::error("An invalid dump type passed {DUMPTYPE}","DUMPTYPE",strDumpType);
elog<InvalidArgument>(
Argument::ARGUMENT_NAME("BMC_DUMP_TYPE"),
Argument::ARGUMENT_VALUE(strDumpType.c_str()));
}
dumpType = DumpTypes::FAULTDATA;
}
#endif

std::string path = extractParameter<std::string>(
convertCreateParametersToString(CreateParameters::FilePath), params);

if ((Manager::fUserDumpInProgress == true) && (dumpType == DumpTypes::USER))
{
lg2::info("Another user initiated dump in progress");
elog<sdbusplus::xyz::openbmc_project::Common::Error::Unavailable>();
}

lg2::info("Initiating new BMC dump with type: {TYPE} path: {PATH}", "TYPE",
lg2::info("Initiating new BMC dump with type: {TYPE} path: {PATH}", "TYPE",
dumpTypeToString(dumpType).value(), "PATH", path);

auto id = captureDump(dumpType, path);

// Entry Object path.
Expand Down Expand Up @@ -118,6 +153,7 @@ uint32_t Manager::captureDump(DumpTypes type, const std::string& path)
{
std::filesystem::path dumpPath(dumpDir);
auto id = std::to_string(lastEntryId + 1);

dumpPath /= id;

auto strType = dumpTypeToString(type).value();
Expand Down
7 changes: 7 additions & 0 deletions dump_manager_bmc.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include "config.h"

#include "dump_entry.hpp"
#include "dump_manager.hpp"
Expand All @@ -11,6 +12,12 @@
#include <filesystem>
#include <map>

#ifdef FAULT_DATA_DUMP
#define CREATE_BMC_DUMP_MAX_PARAMS 3
#else
#define CREATE_BMC_DUMP_MAX_PARAMS 2
#endif

namespace phosphor
{
namespace dump
Expand Down
3 changes: 3 additions & 0 deletions example_dump_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
- xyz.openbmc_project.Dump.Create.DumpType.ErrorLog:
- elog
- BMC_DUMP
- xyz.openbmc_project.Dump.Internal.Create.Type.FaultData:
- faultdata
- BMC_DUMP
8 changes: 8 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,14 @@ conf_data.set_quoted('FAULTLOG_DUMP_PATH', get_option('FAULTLOG_DUMP_PATH'),
conf_data.set('BMC_DUMP_ROTATE_CONFIG', get_option('dump_rotate_config').allowed(),
description : 'Turn on rotate config for bmc dump'
)
conf_data.set('LOG_PEL_ON_DUMP_DELETE', get_option('log_pel_on_dump_delete').enabled(),
description : 'Turn on to log PEL while deleting the dump'
)

conf_data.set('FAULT_DATA_DUMP', get_option('fault_data_dump').enabled(),
description : 'Turn on to enable fault data dump'
)

conf_data.set_quoted('BMC_DUMP_FILENAME_REGEX', get_option('BMC_DUMP_FILENAME_REGEX'),
description: 'BMC Dump filename format'
)
Expand Down
9 changes: 9 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ option('TIMESTAMP_FORMAT', type : 'integer',
description : 'Timestamp format in filename: 0-epoch 1-human readable'
)

option('log_pel_on_dump_delete', type: 'feature',
value : 'disabled',
description : 'Log PEL on deleting the dump'
)
option('fault_data_dump', type: 'feature',
value : 'disabled',
description : 'Dump to store system fault data'
)

# Fault log options

option('FAULTLOG_DUMP_PATH', type : 'string',
Expand Down
13 changes: 13 additions & 0 deletions tools/dreport.d/ibm.d/plugins.d/faultlog
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
#
# config: 6 10
# @brief: Collect faultlog command output.
#

. $DREPORT_INCLUDE/functions

desc="faultlog"
file_name="faultlog.json"
command="faultlog -f"

add_cmd_output "$command" "$file_name" "$desc"
1 change: 1 addition & 0 deletions tools/dreport.d/sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
3: elog
4: checkstop
5: ramoops
6: faultdata