Skip to content

Commit 5da5cab

Browse files
committed
Enable PEL for manager_main
This commit adds code to log a PEL in manager_main file, in case of error where PEL is required. Test: ''' root@p10bmc:~# peltool -i 0x50003273 { "Private Header": { "Section Version": "1", "Sub-section type": "0", "Created by": "bmc vpd", "Created at": "12/10/2024 09:48:07", "Committed at": "12/10/2024 09:48:07", "Creator Subsystem": "BMC", "CSSVER": "", "Platform Log Id": "0x50003273", "Entry Id": "0x50003273", "BMC Event Log Id": "125" }, "User Header": { "Section Version": "1", "Sub-section type": "0", "Log Committed by": "bmc error logging", "Subsystem": "CEC Hardware - VPD Interface", "Event Scope": "Entire Platform", "Event Severity": "Predictive Error", "Event Type": "Not Applicable", "Action Flags": [ "Service Action Required", "Report Externally", "HMC Call Home" ], "Host Transmission": "Not Sent", "HMC Transmission": "Not Sent" }, "Primary SRC": { "Section Version": "1", "Sub-section type": "1", "Created by": "bmc vpd", "SRC Version": "0x02", "SRC Format": "0x55", "Virtual Progress SRC": "False", "I5/OS Service Event Bit": "False", "Hypervisor Dump Initiated":"False", "Backplane CCIN": "2E33", "Terminate FW Error": "False", "Deconfigured": "False", "Guarded": "False", "Error Details": { "Message": "A Json failure occurred." }, "Valid Word Count": "0x09", "Reference Code": "BD554003", "Hex Word 2": "00000055", "Hex Word 3": "2E330010", "Hex Word 4": "00000000", "Hex Word 5": "00000000", "Hex Word 6": "00000000", "Hex Word 7": "00000000", "Hex Word 8": "00000000", "Hex Word 9": "00000000", "Callout Section": { "Callout Count": "1", "Callouts": [{ "FRU Type": "Maintenance Procedure Required", "Priority": "Mandatory, replace all with this type as a unit", "Procedure": "BMC0001" }] } }, "Extended User Header": { "Section Version": "1", "Sub-section type": "0", "Created by": "bmc error logging", "Reporting Machine Type": "9043-MRX", "Reporting Serial Number": "13E8D2X", "FW Released Ver": "", "FW SubSys Version": "fw1110.00-3.34", "Common Ref Time": "00/00/0000 00:00:00", "Symptom Id Len": "20", "Symptom Id": "BD554003_2E330010" }, "Failing MTMS": { "Section Version": "1", "Sub-section type": "0", "Created by": "bmc error logging", "Machine Type Model": "9043-MRX", "Serial Number": "13E8D2X" }, "User Data 0": { "Section Version": "1", "Sub-section type": "1", "Created by": "bmc error logging", "BMCLoad": "0.95 0.69 0.72", "BMCState": "Ready", "BMCUptime": "0y 0d 3h 3m 0s", "BootState": "Unspecified", "ChassisState": "Off", "FW Version ID": "fw1110.00-3.34-2-g45a17a06f3-dirty", "HostState": "Off", "System IM": "50003000" }, "User Data 1": { "Section Version": "1", "Sub-section type": "1", "Created by": "bmc error logging", "DESCRIPTION": "VPD Manager service failed with : Test Error", "FileName": "/usr/src/debug/openpower-fru-vpd/1.0+git/vpd-manager/src/manager_main.cpp", "FunctionName": "main", "InternalRc": "0", "UserData1": "", "UserData2": "" } } ''' Signed-off-by: RekhaAparna01 <[email protected]>
1 parent 092984a commit 5da5cab

File tree

1 file changed

+44
-2
lines changed

1 file changed

+44
-2
lines changed

vpd-manager/src/manager_main.cpp

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#include "config.h"
22

33
#include "bios_handler.hpp"
4+
#include "event_logger.hpp"
5+
#include "exceptions.hpp"
46
#include "logger.hpp"
57
#include "manager.hpp"
8+
#include "types.hpp"
69

710
#include <sdbusplus/asio/connection.hpp>
811
#include <sdbusplus/asio/object_server.hpp>
@@ -44,9 +47,48 @@ int main(int, char**)
4447

4548
exit(EXIT_SUCCESS);
4649
}
47-
catch (const std::exception& e)
50+
catch (const std::exception& l_ex)
4851
{
49-
std::cerr << e.what() << std::endl;
52+
if (typeid(l_ex) == typeid(vpd::JsonException))
53+
{
54+
// ToDo: Severity needs to be revisited.
55+
vpd::EventLogger::createAsyncPel(
56+
vpd::types::ErrorType::JsonFailure,
57+
vpd::types::SeverityType::Informational, __FILE__, __FUNCTION__,
58+
0,
59+
std::string("VPD Manager service failed with : ") + l_ex.what(),
60+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
61+
}
62+
else if (typeid(l_ex) == typeid(vpd::GpioException))
63+
{
64+
// ToDo: Severity needs to be revisited.
65+
vpd::EventLogger::createAsyncPel(
66+
vpd::types::ErrorType::GpioError,
67+
vpd::types::SeverityType::Informational, __FILE__, __FUNCTION__,
68+
0,
69+
std::string("VPD Manager service failed with : ") + l_ex.what(),
70+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
71+
}
72+
else if (typeid(l_ex) == typeid(sdbusplus::exception::SdBusError))
73+
{
74+
// ToDo: Severity needs to be revisited.
75+
vpd::EventLogger::createAsyncPel(
76+
vpd::types::ErrorType::DbusFailure,
77+
vpd::types::SeverityType::Informational, __FILE__, __FUNCTION__,
78+
0,
79+
std::string("VPD Manager service failed with : ") + l_ex.what(),
80+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
81+
}
82+
else
83+
{
84+
// ToDo: Severity needs to be revisited.
85+
vpd::EventLogger::createAsyncPel(
86+
vpd::types::ErrorType::InvalidVpdMessage,
87+
vpd::types::SeverityType::Informational, __FILE__, __FUNCTION__,
88+
0,
89+
std::string("VPD Manager service failed with : ") + l_ex.what(),
90+
"BMC0001", std::nullopt, std::nullopt, std::nullopt);
91+
}
5092
}
5193
exit(EXIT_FAILURE);
5294
}

0 commit comments

Comments
 (0)