Skip to content

Commit c130ba4

Browse files
author
Souvik Roy
committed
Add list of EEPROMs for which collection thread failed (#588)
This commit implements a list in Worker which holds the list of VPD file paths(EEPROM paths) for which collection thread creation has failed. After collection of all FRUs and before setting CollectionStatus as Completed, Manager needs to process this list. Note: Processing the list is a TODO. Test: ``` - Install bitbaked image on Everest system. - Check vpd-manager service status: root@p10bmc:~# systemctl show vpd-manager -p NRestarts NRestarts=0 - Check BMC reaches ready state: root@p10bmc:~# obmcutil state CurrentBMCState : xyz.openbmc_project.State.BMC.BMCState.Ready CurrentPowerState : xyz.openbmc_project.State.Chassis.PowerState.On CurrentHostState : xyz.openbmc_project.State.Host.HostState.Running BootProgress : xyz.openbmc_project.State.Boot.Progress.ProgressStages.OSRunning OperatingSystemState: xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive -Check CollectionStatus property of vpd-manager D-Bus service: root@p10bmc:~# busctl get-property com.ibm.VPD.Manager /com/ibm/VPD/Manager com.ibm.VPD.Manager CollectionStatus s "Completed" ``` Change-Id: I472c54861f590167d8ec767ed6ddb3992c085b0f Signed-off-by: Souvik Roy <[email protected]>
1 parent a5e4cbf commit c130ba4

File tree

4 files changed

+53
-8
lines changed

4 files changed

+53
-8
lines changed

vpd-manager/include/manager.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ class Manager
255255
* @param[in] i_msg - The callback message.
256256
*/
257257
void processAssetTagChangeCallback(sdbusplus::message_t& i_msg);
258+
259+
/**
260+
* @brief API to process list of EEPROMs for which VPD collection thread
261+
* creation has failed.
262+
*/
263+
void ProcessFailedEeproms();
258264
#endif
259265

260266
/**

vpd-manager/include/worker.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,22 @@ class Worker
147147
return m_activeCollectionThreadCount;
148148
}
149149

150+
/**
151+
* @brief API to get the list of EEPROMs for which VPD collection thread
152+
* creation has failed.
153+
*
154+
* This API returns the list of EEPROMs for which VPD collection thread
155+
* creation has failed by reference. Manager needs to process this list of
156+
* EEPROMs and take appropriate action.
157+
*
158+
* @return reference to list of EEPROM paths for which VPD collection thread
159+
* creation has failed
160+
*/
161+
std::forward_list<std::string>& getListOfEepromPathsThreadFailed() noexcept
162+
{
163+
return m_failedEepromPaths;
164+
}
165+
150166
private:
151167
/**
152168
* @brief An API to parse and publish a FRU VPD over D-Bus.
@@ -526,5 +542,8 @@ class Worker
526542
// Counting semaphore to limit the number of threads.
527543
std::counting_semaphore<constants::MAX_THREADS> m_semaphore{
528544
constants::MAX_THREADS};
545+
546+
// List of EEPROM paths for which VPD collection thread creation has failed.
547+
std::forward_list<std::string> m_failedEepromPaths;
529548
};
530549
} // namespace vpd

vpd-manager/src/manager.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ void Manager::SetTimerToDetectSVPDOnDbus()
236236
m_interface->set_property("CollectionStatus",
237237
std::string("InProgress"));
238238
m_worker->collectFrusFromJson();
239+
240+
ProcessFailedEeproms();
239241
}
240242
});
241243
}
@@ -910,4 +912,17 @@ void Manager::performVpdRecollection()
910912
std::string(l_ex.what()));
911913
}
912914
}
915+
916+
void Manager::ProcessFailedEeproms()
917+
{
918+
if (m_worker.get() != nullptr)
919+
{
920+
// TODO:
921+
// - iterate through list of EEPROMs for which thread creation has
922+
// failed
923+
// - get list of FRUs under the EEPROM
924+
// - For each FRU, extract the object path and do collect single FRU
925+
m_worker->getListOfEepromPathsThreadFailed().clear();
926+
}
927+
}
913928
} // namespace vpd

vpd-manager/src/worker.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,21 +1514,26 @@ void Worker::collectFrusFromJson()
15141514
m_activeCollectionThreadCount--;
15151515
m_mutex.unlock();
15161516

1517-
if (!m_activeCollectionThreadCount)
1517+
if (!m_activeCollectionThreadCount &&
1518+
m_failedEepromPaths.empty())
15181519
{
15191520
m_isAllFruCollected = true;
15201521
}
15211522
}}.detach();
15221523
}
15231524
catch (const std::exception& l_ex)
15241525
{
1525-
// TODO: Should we re-try launching thread for this FRU?
1526-
EventLogger::createSyncPel(
1527-
types::ErrorType::InvalidVpdMessage, types::SeverityType::Alert,
1528-
__FILE__, __FUNCTION__, 0,
1529-
std::string("Failed to start collection thread for FRU :[" +
1530-
vpdFilePath + "]. Error: " + l_ex.what()),
1531-
std::nullopt, std::nullopt, std::nullopt, std::nullopt);
1526+
try
1527+
{
1528+
// add vpdFilePath(EEPROM path) to failed list
1529+
m_failedEepromPaths.push_front(vpdFilePath);
1530+
}
1531+
catch (const std::exception& l_ex)
1532+
{
1533+
logging::logMessage(
1534+
"Failed to add [" + vpdFilePath +
1535+
"] to failed EEPROM list. Error: " + l_ex.what());
1536+
}
15321537
}
15331538
}
15341539
}

0 commit comments

Comments
 (0)