Revert commit to fix CI errors
The commit https://gerrit.openbmc.org/c/openbmc/openpower-vpd-parser/+/83309
is being reverted to avoid that many changes just to avoid CI error.
The CI error can be fixed with less change.
Change-Id: Id6aeb4bfe91b66863e95c51153c9f2ec43059554
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 45ebba6..98887f6 100644
--- a/vpd-manager/include/bios_handler.hpp
+++ b/vpd-manager/include/bios_handler.hpp
@@ -235,15 +235,32 @@
*
* @param[in] i_connection - Asio connection object.
* @param[in] i_manager - Manager object.
- * @throw std::exception
*/
BiosHandler(
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);
+ 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:
/**
* @brief API to check if PLDM service is running and run BIOS sync.
*
@@ -252,9 +269,8 @@
* registers a listener to be notified when the service starts so that a
* restore can be performed.
*/
- void checkAndListenPldmService() noexcept;
+ void checkAndListenPldmService();
- private:
/**
* @brief Register listener for BIOS attribute property change.
*
diff --git a/vpd-manager/src/bios_handler.cpp b/vpd-manager/src/bios_handler.cpp
index 3334f0a..c266402 100644
--- a/vpd-manager/src/bios_handler.cpp
+++ b/vpd-manager/src/bios_handler.cpp
@@ -17,61 +17,52 @@
template class BiosHandler<IbmBiosHandler>;
template <typename T>
-void BiosHandler<T>::checkAndListenPldmService() noexcept
+void BiosHandler<T>::checkAndListenPldmService()
{
- try
+ // Setup a call back match on NameOwnerChanged to determine when PLDM is
+ // up.
+ static std::shared_ptr<sdbusplus::bus::match_t> l_nameOwnerMatch =
+ std::make_shared<sdbusplus::bus::match_t>(
+ *m_asioConn,
+ sdbusplus::bus::match::rules::nameOwnerChanged(
+ constants::pldmServiceName),
+ [this](sdbusplus::message_t& l_msg) {
+ if (l_msg.is_method_error())
+ {
+ logging::logMessage(
+ "Error in reading PLDM name owner changed signal.");
+ return;
+ }
+
+ std::string l_name;
+ std::string l_newOwner;
+ std::string l_oldOwner;
+
+ l_msg.read(l_name, l_oldOwner, l_newOwner);
+
+ if (!l_newOwner.empty() &&
+ (l_name.compare(constants::pldmServiceName) ==
+ constants::STR_CMP_SUCCESS))
+ {
+ m_specificBiosHandler->backUpOrRestoreBiosAttributes();
+
+ // Start listener now that we have done the restore.
+ listenBiosAttributes();
+
+ // We don't need the match anymore
+ l_nameOwnerMatch.reset();
+ }
+ });
+
+ // Based on PLDM service status reset owner match registered above and
+ // trigger BIOS attribute sync.
+ if (dbusUtility::isServiceRunning(constants::pldmServiceName))
{
- // Setup a call back match on NameOwnerChanged to determine when PLDM is
- // up.
- static std::shared_ptr<sdbusplus::bus::match_t> l_nameOwnerMatch =
- std::make_shared<sdbusplus::bus::match_t>(
- *m_asioConn,
- sdbusplus::bus::match::rules::nameOwnerChanged(
- constants::pldmServiceName),
- [this](sdbusplus::message_t& l_msg) {
- if (l_msg.is_method_error())
- {
- logging::logMessage(
- "Error in reading PLDM name owner changed signal.");
- return;
- }
+ l_nameOwnerMatch.reset();
+ m_specificBiosHandler->backUpOrRestoreBiosAttributes();
- std::string l_name;
- std::string l_newOwner;
- std::string l_oldOwner;
-
- l_msg.read(l_name, l_oldOwner, l_newOwner);
-
- if (!l_newOwner.empty() &&
- (l_name.compare(constants::pldmServiceName) ==
- constants::STR_CMP_SUCCESS))
- {
- m_specificBiosHandler->backUpOrRestoreBiosAttributes();
-
- // Start listener now that we have done the restore.
- listenBiosAttributes();
-
- // We don't need the match anymore
- l_nameOwnerMatch.reset();
- }
- });
-
- // Based on PLDM service status reset owner match registered above and
- // trigger BIOS attribute sync.
- if (dbusUtility::isServiceRunning(constants::pldmServiceName))
- {
- l_nameOwnerMatch.reset();
- m_specificBiosHandler->backUpOrRestoreBiosAttributes();
-
- // Start listener now that we have done the restore.
- listenBiosAttributes();
- }
- }
- catch (const std::exception& l_ex)
- {
- logging::logMessage(
- "Failed to register callback for PLDM servce. Error: " +
- std::string(l_ex.what()));
+ // Start listener now that we have done the restore.
+ listenBiosAttributes();
}
}
diff --git a/vpd-manager/src/manager_main.cpp b/vpd-manager/src/manager_main.cpp
index 0f8424f..11c2d0b 100644
--- a/vpd-manager/src/manager_main.cpp
+++ b/vpd-manager/src/manager_main.cpp
@@ -35,28 +35,10 @@
auto vpdManager = std::make_shared<vpd::Manager>(
io_con, interface, progressInf, connection);
- try
- {
- // TODO: Take this under conditional compilation for IBM
- auto biosHandler =
- std::make_shared<vpd::BiosHandler<vpd::IbmBiosHandler>>(
- connection, vpdManager);
- biosHandler->checkAndListenPldmService();
- }
- catch (const std::exception& l_ex)
- {
- // Cathcing exception here explicitly to let VPD-Manager service
- // continue even when bios handler fails.
- const std::string& l_errMsg =
- "Instantiation of BIOS Handler failed. { " +
- std::string(l_ex.what()) + std::string(" }");
-
- vpd::EventLogger::createSyncPel(
- vpd::types::ErrorType::FirmwareError,
- vpd::types::SeverityType::Warning, __FILE__, __FUNCTION__, 0,
- l_errMsg, std::nullopt, std::nullopt, std::nullopt,
- std::nullopt);
- }
+ // TODO: Take this under conditional compilation for IBM
+ [[maybe_unused]] auto biosHandler =
+ std::make_shared<vpd::BiosHandler<vpd::IbmBiosHandler>>(
+ connection, vpdManager);
interface->initialize();
progressInf->initialize();