Log PEL if BIOS handler fails
Avoid failing Manager service in case BIOS handler class fails. Handle
failure locally in the calls.
This is required so that failure in BIOS class does not fail the Manager
service and put BMC into Quiesced state.
Change-Id: Ic4f3aa360dc8703de591057b9208b0a31591885c
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/include/bios_handler.hpp b/vpd-manager/include/bios_handler.hpp
index 08e76b7..2408b2f 100644
--- a/vpd-manager/include/bios_handler.hpp
+++ b/vpd-manager/include/bios_handler.hpp
@@ -240,8 +240,25 @@
const std::shared_ptr<sdbusplus::asio::connection>& i_connection,
const std::shared_ptr<Manager>& i_manager) : m_asioConn(i_connection)
{
- m_specificBiosHandler = std::make_shared<T>(i_manager);
- checkAndListenPldmService();
+ try
+ {
+ m_specificBiosHandler = std::make_shared<T>(i_manager);
+ checkAndListenPldmService();
+ }
+ catch (std::exception& l_ex)
+ {
+ // catch any exception here itself and don't pass it to main as it
+ // will mark the service failed. Since VPD-Manager is a critical
+ // service, failing it can push BMC to quiesced state whic is not
+ // required in this case.
+ std::string l_errMsg = "Instantiation of BIOS Handler failed. { ";
+ l_errMsg += l_ex.what() + std::string(" }");
+
+ EventLogger::createSyncPel(
+ types::ErrorType::FirmwareError, types::SeverityType::Warning,
+ __FILE__, __FUNCTION__, 0, l_errMsg, std::nullopt, std::nullopt,
+ std::nullopt, std::nullopt);
+ }
}
private:
diff --git a/vpd-manager/src/bios_handler.cpp b/vpd-manager/src/bios_handler.cpp
index 683d5db..73dd229 100644
--- a/vpd-manager/src/bios_handler.cpp
+++ b/vpd-manager/src/bios_handler.cpp
@@ -145,8 +145,12 @@
}
else
{
- // TODO: log a predicitive PEL.
- logging::logMessage("Invalid typre received from BIOS table.");
+ logging::logMessage("Invalid type received for BIOS table.");
+ EventLogger::createSyncPel(
+ types::ErrorType::FirmwareError, types::SeverityType::Warning,
+ __FILE__, __FUNCTION__, 0,
+ std::string("Invalid type received for BIOS table."),
+ std::nullopt, std::nullopt, std::nullopt, std::nullopt);
break;
}
}