PEL: Use new Compatible interface
Code previously looked at an IBMCompatible interface provided by
entity-manager to get the system type in order to find the device
callouts file when necessary.
EM now also puts the xyz.openbmc_project.Inventory.Decorator.Compatible
on D-Bus with the same Names property.
Change the code to use this new interface so it isn't using an IBM
specific one.
Tested:
With the dev_callouts file renamed in /usr/share:
```
/usr/share/phosphor-logging/pels# ls *Rainier2U*
com.ibm.Hardware.Chassis.Model.Rainier2U_dev_callouts.json
```
and with entity-manager hosting the new interface:
```
busctl get-property xyz.openbmc_project.EntityManager
/xyz/openbmc_project/inventory/system/chassis/Rainier_2U_Chassis \
xyz.openbmc_project.Inventory.Decorator.Compatible Names \
as 2
"com.ibm.Hardware.Chassis.Model.Rainier2U"
"com.ibm.Hardware.Chassis.Model.Rainier"
```
Creating a PEL with a device path callout:
```
CALLOUT_DEVICE_PATH /sys/bus/i2c/devices/7-0052
```
Leads to PEL callouts of:
```
"Callout Section": {
"Callout Count": "3",
"Callouts": [{
"FRU Type": "Normal Hardware FRU",
"Priority": "Mandatory, replace all with this type as a unit",
"Location Code": "U78DA.ND0.1234567-P0-C5",
"Part Number": "F191014",
"CCIN": "6B58",
"Serial Number": "YL6B58010000"
}, {
"FRU Type": "Normal Hardware FRU",
"Priority": "Mandatory, replace all with this type as a unit",
"Location Code": "U78DA.ND0.1234567-P0-T10",
"Part Number": "F191014",
"CCIN": "2E2D",
"Serial Number": "YL2E2D010000"
}, {
"FRU Type": "Normal Hardware FRU",
"Priority": "Lowest priority replacement",
"Location Code": "U78DA.ND0.1234567-P0",
"Part Number": "F191014",
"CCIN": "2E2D",
"Serial Number": "YL2E2D010000"
}]
}
```
which matches what's in the file.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I42b71ba184c9526ec3d29360b062c2a335dca343
diff --git a/extensions/openpower-pels/data_interface.cpp b/extensions/openpower-pels/data_interface.cpp
index cdebc21..c9a944c 100644
--- a/extensions/openpower-pels/data_interface.cpp
+++ b/extensions/openpower-pels/data_interface.cpp
@@ -42,6 +42,7 @@
constexpr auto bootRawProgress = "xyz.openbmc_project.State.Boot.Raw";
constexpr auto pldm = "xyz.openbmc_project.PLDM";
constexpr auto inventoryManager = "xyz.openbmc_project.Inventory.Manager";
+constexpr auto entityManager = "xyz.openbmc_project.EntityManager";
} // namespace service_name
namespace object_path
@@ -77,7 +78,7 @@
constexpr auto vsbpRecordVPD = "com.ibm.ipzvpd.VSBP";
constexpr auto locCode = "xyz.openbmc_project.Inventory.Decorator.LocationCode";
constexpr auto compatible =
- "xyz.openbmc_project.Configuration.IBMCompatibleSystem";
+ "xyz.openbmc_project.Inventory.Decorator.Compatible";
constexpr auto vpdManager = "com.ibm.VPD.Manager";
constexpr auto ledGroup = "xyz.openbmc_project.Led.Group";
constexpr auto operationalStatus =
@@ -621,13 +622,20 @@
throw std::runtime_error("Compatible interface not on D-Bus");
}
- const auto& object = *(subtree.begin());
- const auto& path = object.first;
- const auto& service = object.second.begin()->first;
+ for (const auto& [path, interfaceMap] : subtree)
+ {
+ auto iface = interfaceMap.find(service_name::entityManager);
+ if (iface == interfaceMap.end())
+ {
+ continue;
+ }
- getProperty(service, path, interface::compatible, "Names", names);
+ getProperty(iface->first, path, interface::compatible, "Names", names);
- return std::get<std::vector<std::string>>(names);
+ return std::get<std::vector<std::string>>(names);
+ }
+
+ throw std::runtime_error("EM Compatible interface not on D-Bus");
}
bool DataInterface::getQuiesceOnError() const