Skip System VPD Collection if powered ON
This commit skips system VPD collection if we are powered ON.
By extension, this will also cause us to skip priming the inventory.
This makes sure that we don't prime the inventory objects with
default (false) presence on a reset-reload path. FRUs like the CPU
are inaccessible when powered ON and priming them means we lose
presence information entirely on a reset-reload.
Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Change-Id: Ia07c3365a8a3d64836e02d82d9845c86907eac53
diff --git a/ibm_vpd_app.cpp b/ibm_vpd_app.cpp
index b4217c5..8551fcd 100644
--- a/ibm_vpd_app.cpp
+++ b/ibm_vpd_app.cpp
@@ -1242,7 +1242,12 @@
baseFruInventoryPath = js["frus"][file][0]["inventoryPath"];
// Check if we can read the VPD file based on the power state
- if (js["frus"][file].at(0).value("powerOffOnly", false))
+ // We skip reading VPD when the power is ON in two scenarios:
+ // 1) The eeprom we are trying to read is that of the system VPD
+ // 2) The JSON tells us that the FRU EEPROM cannot be read when
+ // we are powered ON.
+ if (js["frus"][file].at(0).value("powerOffOnly", false) ||
+ (file == systemVpdFilePath))
{
if ("xyz.openbmc_project.State.Chassis.PowerState.On" ==
getPowerState())