From 7dc81ad5f35379ab99be1dba6b082b28c82c733f Mon Sep 17 00:00:00 2001 From: RekhaAparna01 Date: Thu, 2 Jan 2025 10:25:51 -0600 Subject: [PATCH] Enable PEL for Bios Handler Class This commit adds code to log PEL in BiosHandler class, in case of error where PEL is required. Signed-off-by: RekhaAparna01 --- vpd-manager/src/bios_handler.cpp | 53 ++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/vpd-manager/src/bios_handler.cpp b/vpd-manager/src/bios_handler.cpp index 3cb2f327..845d6994 100644 --- a/vpd-manager/src/bios_handler.cpp +++ b/vpd-manager/src/bios_handler.cpp @@ -3,6 +3,7 @@ #include "bios_handler.hpp" #include "constants.hpp" +#include "event_logger.hpp" #include "logger.hpp" #include @@ -145,7 +146,12 @@ void IbmBiosHandler::biosAttributesCallback(sdbusplus::message_t& i_msg) } else { - // TODO: log a predicitive PEL. + EventLogger::createSyncPel( + types::ErrorType::DbusFailure, types::SeverityType::Warning, + __FILE__, __FUNCTION__, 0, + "Invalid typre received from BIOS table.", std::nullopt, + std::nullopt, std::nullopt, std::nullopt); + logging::logMessage("Invalid typre received from BIOS table."); break; } @@ -299,10 +305,12 @@ void IbmBiosHandler::saveFcoToBios(const types::BinaryVector& i_fcoVal) } catch (const std::exception& l_ex) { - // TODO: Should we log informational PEL here as well? - logging::logMessage( + EventLogger::createSyncPel( + types::ErrorType::DbusFailure, types::SeverityType::Informational, + __FILE__, __FUNCTION__, 0, "DBus call to update FCO value in pending attribute failed. " + - std::string(l_ex.what())); + std::string(l_ex.what()), + std::nullopt, std::nullopt, std::nullopt, std::nullopt); } } @@ -346,9 +354,11 @@ void IbmBiosHandler::saveAmmToVpd(const std::string& i_memoryMirrorMode) } else { - // TODO: Add PEL - logging::logMessage( - "Invalid type read for memory mirror mode value from DBus. Skip writing to VPD"); + EventLogger::createSyncPel( + types::ErrorType::DbusFailure, types::SeverityType::Informational, + __FILE__, __FUNCTION__, 0, + "Invalid type read for memory mirror mode value from DBus. Skip writing to VPD", + std::nullopt, std::nullopt, std::nullopt, std::nullopt); } } @@ -379,10 +389,12 @@ void IbmBiosHandler::saveAmmToBios(const std::string& i_ammVal) } catch (const std::exception& l_ex) { - // TODO: Should we log informational PEL here as well? - logging::logMessage( + EventLogger::createSyncPel( + types::ErrorType::DbusFailure, types::SeverityType::Informational, + __FILE__, __FUNCTION__, 0, "DBus call to update AMM value in pending attribute failed. " + - std::string(l_ex.what())); + std::string(l_ex.what()), + std::nullopt, std::nullopt, std::nullopt, std::nullopt); } } @@ -514,9 +526,12 @@ void IbmBiosHandler::saveCreateDefaultLparToBios( } catch (const std::exception& l_ex) { - logging::logMessage( + EventLogger::createSyncPel( + types::ErrorType::DbusFailure, types::SeverityType::Informational, + __FILE__, __FUNCTION__, 0, "DBus call to update lpar value in pending attribute failed. " + - std::string(l_ex.what())); + std::string(l_ex.what()), + std::nullopt, std::nullopt, std::nullopt, std::nullopt); } return; @@ -630,9 +645,12 @@ void IbmBiosHandler::saveClearNvramToBios(const std::string& i_clearNvramVal) } catch (const std::exception& l_ex) { - logging::logMessage( + EventLogger::createSyncPel( + types::ErrorType::DbusFailure, types::SeverityType::Informational, + __FILE__, __FUNCTION__, 0, "DBus call to update NVRAM value in pending attribute failed. " + - std::string(l_ex.what())); + std::string(l_ex.what()), + std::nullopt, std::nullopt, std::nullopt, std::nullopt); } } @@ -741,9 +759,12 @@ void IbmBiosHandler::saveKeepAndClearToBios( } catch (const std::exception& l_ex) { - logging::logMessage( + EventLogger::createSyncPel( + types::ErrorType::DbusFailure, types::SeverityType::Informational, + __FILE__, __FUNCTION__, 0, "DBus call to update keep and clear value in pending attribute failed. " + - std::string(l_ex.what())); + std::string(l_ex.what()), + std::nullopt, std::nullopt, std::nullopt, std::nullopt); } }