Fix threshold probability loss
During bmc reset stress testing, some sensors occasionally lose
thresholds, and the lost thresholds are not created on DBus.
This is because when EM loads the json file and creates interface,
dbus-sensors may have listened and started to create the sensor just
after the `Type` interface is created but before the threshold
interface is created. This is the sensor interface obtained from EM
and does not include the threshold interface. Therefore, the sensor
displayed on DBus does not have a threshold interface.
This commit changes the order of creating interfaces in EM. The Type
interface should be created after the Threshold interface is created.
This is because for the callback method of dbus-sensors, when the
Type interface is created, it is considered that all configurations
of this sensor have been loaded.
Tested:
The bmc reset stress test did not reproduce this issue.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: Ia8d9e24a8697992cab13aecb35438f142ed29e67
diff --git a/src/entity_manager.cpp b/src/entity_manager.cpp
index f76a6f5..96eb384 100644
--- a/src/entity_manager.cpp
+++ b/src/entity_manager.cpp
@@ -700,11 +700,6 @@
ifacePath += "/";
ifacePath += itemName;
- std::shared_ptr<sdbusplus::asio::dbus_interface> itemIface =
- createInterface(objServer, ifacePath,
- "xyz.openbmc_project.Configuration." + itemType,
- boardNameOrig);
-
if (itemType == "BMC")
{
std::shared_ptr<sdbusplus::asio::dbus_interface> bmcIface =
@@ -726,10 +721,6 @@
getPermission(itemType));
}
- populateInterfaceFromJson(systemConfiguration, jsonPointerPath,
- itemIface, item, objServer,
- getPermission(itemType));
-
for (const auto& [name, config] : item.items())
{
jsonPointerPath = jsonPointerPathBoard;
@@ -800,6 +791,15 @@
}
}
+ std::shared_ptr<sdbusplus::asio::dbus_interface> itemIface =
+ createInterface(objServer, ifacePath,
+ "xyz.openbmc_project.Configuration." + itemType,
+ boardNameOrig);
+
+ populateInterfaceFromJson(systemConfiguration, jsonPointerPath,
+ itemIface, item, objServer,
+ getPermission(itemType));
+
topology.addBoard(boardPath, boardType, boardNameOrig, item);
}