Do not populate presence if handlePresence=false
This commit is to skip populating Present property for those frus whose
handlePresence is made false explicitly in VPD JSON.
This is required in cases where the FRU has its own VPD, yet its
presence gets handled by other application and not by VPD parser app.
Test:
Test works as expected.
To note:
phosphor-fan-monitor identifies and sets the fan presence before
collecting system VPD. Journal log be like,
Feb 14 12:54:08 ever6bmc phosphor-fan-monitor[601]: Fan /system/chassis/motherboard/fan0 presence state change to true
Feb 14 12:54:09 ever6bmc systemd[1]: Finished Wait for /xyz/openbmc_project/led/groups/bmc_booted.
Feb 14 12:54:09 ever6bmc phosphor-psu-monitor[604]: Binding device driver. path: /sys/bus/i2c/drivers/ibm-cffps/bind device: 3-006b
Feb 14 12:54:09 ever6bmc phosphor-psu-monitor[604]: Failed binding or unbinding device. errno=16
Feb 14 12:54:09 ever6bmc phosphor-psu-monitor[604]: Updating inventory present property. present:true invpath:/system/chassis/motherboard/powersupply3 name:powersupply3
Feb 14 12:54:09 ever6bmc systemd[1]: Starting Wait for /xyz/openbmc_project/led/groups...
Feb 14 12:54:09 ever6bmc systemd[1]: Starting Set the Asserted property of all the LED groups to false...
Feb 14 12:54:09 ever6bmc systemd[1]: Starting Update BIOS attr table with host firmware well-known names...
Feb 14 12:54:09 ever6bmc systemd[1]: Started Network IPMI daemon.
Feb 14 12:54:09 ever6bmc systemd[1]: Started Network IPMI daemon.
Feb 14 12:54:09 ever6bmc systemd[1]: Starting System VPD Collection...
Tested in the above mentioned scenario:
-> busctl set-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/
inventory/system/chassis/motherboard/fan0 xyz.openbmc_project.Inventory.Item
Present b false
->busctl introspect xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0
xyz.openbmc_project.Inventory.Item interface - - -
.Present property b false emits-change writable
.PrettyName property s "fan0"
-> busctl set-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/
inventory/system/chassis/motherboard xyz.openbmc_project.Inventory.Item Present b false
->systemctl restart system-vpd.service
Result:
busctl introspect xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0
xyz.openbmc_project.Inventory.Item interface - - -
.Present property b false emits-change writable
.PrettyName property s "fan0"
Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
Change-Id: I775380792b0f031efdff8c42e236b822ba3c2b45
diff --git a/ibm_vpd/fru/50003000.json b/ibm_vpd/fru/50003000.json
index a7ec9a6..af46a95 100644
--- a/ibm_vpd/fru/50003000.json
+++ b/ibm_vpd/fru/50003000.json
@@ -2440,6 +2440,7 @@
"devAddress": "31-0050",
"driverType": "at24",
"busType": "i2c",
+ "handlePresence": false,
"concurrentlyMaintainable": true,
"extraInterfaces": {
"xyz.openbmc_project.Inventory.Item.Fan": null,
@@ -2455,6 +2456,7 @@
"devAddress": "32-0050",
"driverType": "at24",
"busType": "i2c",
+ "handlePresence": false,
"concurrentlyMaintainable": true,
"extraInterfaces": {
"xyz.openbmc_project.Inventory.Item.Fan": null,
@@ -2470,6 +2472,7 @@
"devAddress": "33-0050",
"driverType": "at24",
"busType": "i2c",
+ "handlePresence": false,
"concurrentlyMaintainable": true,
"extraInterfaces": {
"xyz.openbmc_project.Inventory.Item.Fan": null,
@@ -2485,6 +2488,7 @@
"devAddress": "34-0050",
"driverType": "at24",
"busType": "i2c",
+ "handlePresence": false,
"concurrentlyMaintainable": true,
"extraInterfaces": {
"xyz.openbmc_project.Inventory.Item.Fan": null,
diff --git a/ibm_vpd/fru/50003000_v2.json b/ibm_vpd/fru/50003000_v2.json
index 59e36da..0c4bfd1 100644
--- a/ibm_vpd/fru/50003000_v2.json
+++ b/ibm_vpd/fru/50003000_v2.json
@@ -2440,6 +2440,7 @@
"devAddress": "31-0050",
"driverType": "at24",
"busType": "i2c",
+ "handlePresence": false,
"concurrentlyMaintainable": true,
"extraInterfaces": {
"xyz.openbmc_project.Inventory.Item.Fan": null,
@@ -2455,6 +2456,7 @@
"devAddress": "32-0050",
"driverType": "at24",
"busType": "i2c",
+ "handlePresence": false,
"concurrentlyMaintainable": true,
"extraInterfaces": {
"xyz.openbmc_project.Inventory.Item.Fan": null,
@@ -2470,6 +2472,7 @@
"devAddress": "33-0050",
"driverType": "at24",
"busType": "i2c",
+ "handlePresence": false,
"concurrentlyMaintainable": true,
"extraInterfaces": {
"xyz.openbmc_project.Inventory.Item.Fan": null,
@@ -2485,6 +2488,7 @@
"devAddress": "34-0050",
"driverType": "at24",
"busType": "i2c",
+ "handlePresence": false,
"concurrentlyMaintainable": true,
"extraInterfaces": {
"xyz.openbmc_project.Inventory.Item.Fan": null,
diff --git a/ibm_vpd_app.cpp b/ibm_vpd_app.cpp
index c530c61..367f8d2 100644
--- a/ibm_vpd_app.cpp
+++ b/ibm_vpd_app.cpp
@@ -667,14 +667,22 @@
inventory::PropertyMap presProp;
// Do not populate Present property for frus whose
- // synthesized=true. synthesized=true says the fru is owned by
- // some other component and not by vpd.
+ // synthesized=true. synthesized=true says the fru VPD is
+ // synthesized and owned by a separate component.
+ // In some cases, the FRU has its own VPD, but still a separate
+ // application handles the FRU's presence. So VPD parser skips
+ // populating Present property by checking the JSON flag,
+ // "handlePresence".
if (!itemEEPROM.value("synthesized", false))
{
- presProp.emplace("Present", false);
- interfaces.emplace("xyz.openbmc_project.Inventory.Item",
- presProp);
+ if (itemEEPROM.value("handlePresence", true))
+ {
+ presProp.emplace("Present", false);
+ interfaces.emplace("xyz.openbmc_project.Inventory.Item",
+ presProp);
+ }
}
+
setOneTimeProperties(object, interfaces);
if (itemEEPROM.find("extraInterfaces") != itemEEPROM.end())
{
@@ -1286,9 +1294,13 @@
if ((item.value("embedded", true)) &&
(!item.value("synthesized", false)))
{
- inventory::PropertyMap presProp;
- presProp.emplace("Present", true);
- insertOrMerge(interfaces, invItemIntf, move(presProp));
+ // Check if its required to handle presence for this FRU.
+ if (item.value("handlePresence", true))
+ {
+ inventory::PropertyMap presProp;
+ presProp.emplace("Present", true);
+ insertOrMerge(interfaces, invItemIntf, move(presProp));
+ }
}
if constexpr (is_same<T, Parsed>::value)