summaryrefslogtreecommitdiffstats
path: root/occ_manager.cpp
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2017-10-25 04:26:07 -0500
committerDeepak Kodihalli <dkodihal@in.ibm.com>2017-10-25 05:42:05 -0500
commit370f06b42bfd1912b3bb64038becdd90292d0f39 (patch)
treed980b126d48119c29800d1a2d1420eca66145cb8 /occ_manager.cpp
parent3f3fa5618bea2e2f5ba436506272ca013951144f (diff)
downloadopenpower-occ-control-370f06b42bfd1912b3bb64038becdd90292d0f39.tar.gz
openpower-occ-control-370f06b42bfd1912b3bb64038becdd90292d0f39.zip
Always watch for CPU inventory creation
Previously the app would watch for CPU inventory being created (in order to create OCC objects) only if no CPU inventory existed when the app starts. This logic breaks when some of the CPUs exist out of the max possible, because we would never watch for those missing CPU objects being potentially created in the next boot. Instead, always watch for CPU inventory being created via the d-bus InterfacesAdded signal. This is safe in case a persisted CPU object existed in the inventory, because the signal would not fire on that object. Resolves openbmc/openbmc#2515. Change-Id: I0b7ae84d98cd05fe355d4ff56ebaa14da3a3098a Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'occ_manager.cpp')
-rw-r--r--occ_manager.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/occ_manager.cpp b/occ_manager.cpp
index 09cefcc..df53f7d 100644
--- a/occ_manager.cpp
+++ b/occ_manager.cpp
@@ -15,23 +15,21 @@ namespace occ
void Manager::findAndCreateObjects()
{
- // Check if CPU inventory exists already.
- auto occs = open_power::occ::finder::get(bus);
- if (occs.empty())
+ // Need to watch for CPU inventory creation.
+ for (auto id = 0; id < MAX_CPUS; ++id)
{
- // Need to watch for CPU inventory creation.
- for (auto id = 0; id < MAX_CPUS; ++id)
- {
- auto path = std::string(CPU_PATH) + std::to_string(id);
- cpuMatches.emplace_back(
- bus,
- sdbusRule::interfacesAdded() +
- sdbusRule::argNpath(0, path),
- std::bind(std::mem_fn(&Manager::cpuCreated),
- this, std::placeholders::_1));
- }
+ auto path = std::string(CPU_PATH) + std::to_string(id);
+ cpuMatches.emplace_back(
+ bus,
+ sdbusRule::interfacesAdded() +
+ sdbusRule::argNpath(0, path),
+ std::bind(std::mem_fn(&Manager::cpuCreated),
+ this, std::placeholders::_1));
}
- else
+
+ // Check if CPU inventory exists already.
+ auto occs = open_power::occ::finder::get(bus);
+ if (!occs.empty())
{
for (const auto& occ : occs)
{
OpenPOWER on IntegriCloud