Skip to content

Commit 9b6fbf0

Browse files
committed
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 <[email protected]>
1 parent f92c478 commit 9b6fbf0

File tree

1 file changed

+36
-17
lines changed

1 file changed

+36
-17
lines changed

vpd-manager/src/bios_handler.cpp

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "bios_handler.hpp"
44

55
#include "constants.hpp"
6+
#include "event_logger.hpp"
67
#include "logger.hpp"
78

89
#include <sdbusplus/bus/match.hpp>
@@ -145,8 +146,11 @@ void IbmBiosHandler::biosAttributesCallback(sdbusplus::message_t& i_msg)
145146
}
146147
else
147148
{
148-
// TODO: log a predicitive PEL.
149-
logging::logMessage("Invalid typre received from BIOS table.");
149+
EventLogger::createSyncPel(
150+
types::ErrorType::InvalidVpdMessage,
151+
types::SeverityType::Warning, __FILE__, __FUNCTION__, 0,
152+
"Invalid type received from BIOS table.", std::nullopt,
153+
std::nullopt, std::nullopt, std::nullopt);
150154
break;
151155
}
152156
}
@@ -299,10 +303,12 @@ void IbmBiosHandler::saveFcoToBios(const types::BinaryVector& i_fcoVal)
299303
}
300304
catch (const std::exception& l_ex)
301305
{
302-
// TODO: Should we log informational PEL here as well?
303-
logging::logMessage(
306+
EventLogger::createSyncPel(
307+
types::ErrorType::DbusFailure, types::SeverityType::Informational,
308+
__FILE__, __FUNCTION__, 0,
304309
"DBus call to update FCO value in pending attribute failed. " +
305-
std::string(l_ex.what()));
310+
std::string(l_ex.what()),
311+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
306312
}
307313
}
308314

@@ -346,9 +352,11 @@ void IbmBiosHandler::saveAmmToVpd(const std::string& i_memoryMirrorMode)
346352
}
347353
else
348354
{
349-
// TODO: Add PEL
350-
logging::logMessage(
351-
"Invalid type read for memory mirror mode value from DBus. Skip writing to VPD");
355+
EventLogger::createSyncPel(
356+
types::ErrorType::InvalidVpdMessage,
357+
types::SeverityType::Informational, __FILE__, __FUNCTION__, 0,
358+
"Invalid type read for memory mirror mode value from DBus. Skip writing to VPD",
359+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
352360
}
353361
}
354362

@@ -379,10 +387,12 @@ void IbmBiosHandler::saveAmmToBios(const std::string& i_ammVal)
379387
}
380388
catch (const std::exception& l_ex)
381389
{
382-
// TODO: Should we log informational PEL here as well?
383-
logging::logMessage(
390+
EventLogger::createSyncPel(
391+
types::ErrorType::DbusFailure, types::SeverityType::Informational,
392+
__FILE__, __FUNCTION__, 0,
384393
"DBus call to update AMM value in pending attribute failed. " +
385-
std::string(l_ex.what()));
394+
std::string(l_ex.what()),
395+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
386396
}
387397
}
388398

@@ -514,9 +524,12 @@ void IbmBiosHandler::saveCreateDefaultLparToBios(
514524
}
515525
catch (const std::exception& l_ex)
516526
{
517-
logging::logMessage(
527+
EventLogger::createSyncPel(
528+
types::ErrorType::DbusFailure, types::SeverityType::Informational,
529+
__FILE__, __FUNCTION__, 0,
518530
"DBus call to update lpar value in pending attribute failed. " +
519-
std::string(l_ex.what()));
531+
std::string(l_ex.what()),
532+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
520533
}
521534

522535
return;
@@ -630,9 +643,12 @@ void IbmBiosHandler::saveClearNvramToBios(const std::string& i_clearNvramVal)
630643
}
631644
catch (const std::exception& l_ex)
632645
{
633-
logging::logMessage(
646+
EventLogger::createSyncPel(
647+
types::ErrorType::DbusFailure, types::SeverityType::Informational,
648+
__FILE__, __FUNCTION__, 0,
634649
"DBus call to update NVRAM value in pending attribute failed. " +
635-
std::string(l_ex.what()));
650+
std::string(l_ex.what()),
651+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
636652
}
637653
}
638654

@@ -741,9 +757,12 @@ void IbmBiosHandler::saveKeepAndClearToBios(
741757
}
742758
catch (const std::exception& l_ex)
743759
{
744-
logging::logMessage(
760+
EventLogger::createSyncPel(
761+
types::ErrorType::DbusFailure, types::SeverityType::Informational,
762+
__FILE__, __FUNCTION__, 0,
745763
"DBus call to update keep and clear value in pending attribute failed. " +
746-
std::string(l_ex.what()));
764+
std::string(l_ex.what()),
765+
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
747766
}
748767
}
749768

0 commit comments

Comments
 (0)