only return fw images in FirmwareInventory
Some systems create a xyz.openbmc_project.Software.Version D-bus object
for reasons other then storing a FirmwareInventory object. For example
the phosphor-logging code can add it to a log to track what level of
code was running when a log was created. These should not show up in the
Redfish FirmwareInventory API.
Tested:
Before this change, 3 and 4 correlated to phosphor-logs on system
curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/
{
"@odata.context": "/redfish/v1/$metadata#SoftwareInventoryCollection.SoftwareInventoryCollection",
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory",
"@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
"Members": [
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/3"
},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/4"
},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/224cd310"
},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/3b296352"
},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/e9b7a436"
}
],
"Members@odata.count": 5,
"Name": "Software Inventory Collection"
}
After:
Verified 3 and 4 were no longer returned in FirmwareInventory
curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/
{
"@odata.context": "/redfish/v1/$metadata#SoftwareInventoryCollection.SoftwareInventoryCollection",
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory",
"@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection",
"Members": [
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/224cd310"
},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/2d556644"
},
{
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/7432374c"
}
],
"Members@odata.count": 3,
"Name": "Software Inventory Collection"
}
Ran Redfish validator and ensured no errors
Change-Id: I3e99fe7570b87b83f75918873267fb1587add182
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index e3f5df7..ec9600e 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -566,10 +566,14 @@
members.size();
}
},
+ // Note that only firmware levels associated with a device are
+ // stored under /xyz/openbmc_project/software therefore to ensure
+ // only real FirmwareInventory items are returned, this full object
+ // path must be used here as input to mapper
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/",
- static_cast<int32_t>(0),
+ "xyz.openbmc_project.ObjectMapper", "GetSubTree",
+ "/xyz/openbmc_project/software", static_cast<int32_t>(0),
std::array<const char *, 1>{
"xyz.openbmc_project.Software.Version"});
}