Skip to content

Commit

Permalink
Enable PEL for Bios Handler Class
Browse files Browse the repository at this point in the history
This commit adds code to log PEL in BiosHandler class, in case of
error where PEL is required.

Signed-off-by: RekhaAparna01 <vrekhaaparna@ibm.com>
  • Loading branch information
RekhaAparna01 committed Jan 6, 2025
1 parent f92c478 commit 7dc81ad
Showing 1 changed file with 37 additions and 16 deletions.
53 changes: 37 additions & 16 deletions vpd-manager/src/bios_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "bios_handler.hpp"

#include "constants.hpp"
#include "event_logger.hpp"
#include "logger.hpp"

#include <sdbusplus/bus/match.hpp>
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 7dc81ad

Please sign in to comment.