Add ObjectManager in the right place
Per
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/55308
dbus-sensors has been putting the ObjectManager in the wrong place. Fix
that.
Tested:
Loaded build with all patches under this same topic, and observed IPMI
and Redfish trees working correctly and responding with sensor data.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iefe050fe50658de6e1f215eab95b1f772e50eb4a
diff --git a/src/ADCSensorMain.cpp b/src/ADCSensorMain.cpp
index d174f64..0db56a9 100644
--- a/src/ADCSensorMain.cpp
+++ b/src/ADCSensorMain.cpp
@@ -299,8 +299,10 @@
{
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+ objectServer.add_manager("/xyz/openbmc_project/sensors");
+
systemBus->request_name("xyz.openbmc_project.ADCSensor");
- sdbusplus::asio::object_server objectServer(systemBus);
boost::container::flat_map<std::string, std::shared_ptr<ADCSensor>> sensors;
auto sensorsChanged =
std::make_shared<boost::container::flat_set<std::string>>();
diff --git a/src/ExternalSensorMain.cpp b/src/ExternalSensorMain.cpp
index a954bcc..aa1e6b8 100644
--- a/src/ExternalSensorMain.cpp
+++ b/src/ExternalSensorMain.cpp
@@ -339,8 +339,11 @@
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+
+ objectServer.add_manager("/xyz/openbmc_project/sensors");
systemBus->request_name("xyz.openbmc_project.ExternalSensor");
- sdbusplus::asio::object_server objectServer(systemBus);
+
boost::container::flat_map<std::string, std::shared_ptr<ExternalSensor>>
sensors;
auto sensorsChanged =
diff --git a/src/FanMain.cpp b/src/FanMain.cpp
index 9283fde..b94fb45 100644
--- a/src/FanMain.cpp
+++ b/src/FanMain.cpp
@@ -542,8 +542,10 @@
{
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+
+ objectServer.add_manager("/xyz/openbmc_project/sensors");
systemBus->request_name("xyz.openbmc_project.FanSensor");
- sdbusplus::asio::object_server objectServer(systemBus);
boost::container::flat_map<std::string, std::shared_ptr<TachSensor>>
tachSensors;
boost::container::flat_map<std::string, std::unique_ptr<PwmSensor>>
diff --git a/src/HwmonTempMain.cpp b/src/HwmonTempMain.cpp
index 9fd3c10..79db947 100644
--- a/src/HwmonTempMain.cpp
+++ b/src/HwmonTempMain.cpp
@@ -505,8 +505,10 @@
{
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+ objectServer.add_manager("/xyz/openbmc_project/sensors");
systemBus->request_name("xyz.openbmc_project.HwmonTempSensor");
- sdbusplus::asio::object_server objectServer(systemBus);
+
boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>
sensors;
auto sensorsChanged =
diff --git a/src/IntelCPUSensorMain.cpp b/src/IntelCPUSensorMain.cpp
index 0d7f896..aa06628 100644
--- a/src/IntelCPUSensorMain.cpp
+++ b/src/IntelCPUSensorMain.cpp
@@ -708,7 +708,8 @@
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
boost::container::flat_set<CPUConfig> cpuConfigs;
- sdbusplus::asio::object_server objectServer(systemBus);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+ objectServer.add_manager("/xyz/openbmc_project/sensors");
boost::asio::steady_timer pingTimer(io);
boost::asio::steady_timer creationTimer(io);
boost::asio::steady_timer filterTimer(io);
diff --git a/src/IntrusionSensorMain.cpp b/src/IntrusionSensorMain.cpp
index f46254f..3b63b6e 100644
--- a/src/IntrusionSensorMain.cpp
+++ b/src/IntrusionSensorMain.cpp
@@ -419,11 +419,14 @@
// setup connection to dbus
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
- auto objServer = sdbusplus::asio::object_server(systemBus);
// setup object server, define interface
systemBus->request_name("xyz.openbmc_project.IntrusionSensor");
+ sdbusplus::asio::object_server objServer(systemBus, true);
+
+ objServer.add_manager("/xyz/openbmc_project/sensors");
+
std::shared_ptr<sdbusplus::asio::dbus_interface> ifaceChassis =
objServer.add_interface(
"/xyz/openbmc_project/Intrusion/Chassis_Intrusion",
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index f594ed5..39e385d 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -601,8 +601,9 @@
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+ objectServer.add_manager("/xyz/openbmc_project/sensors");
systemBus->request_name("xyz.openbmc_project.IpmbSensor");
- sdbusplus::asio::object_server objectServer(systemBus);
initCmdTimer = std::make_unique<boost::asio::steady_timer>(io);
diff --git a/src/MCUTempSensor.cpp b/src/MCUTempSensor.cpp
index 2c28fe0..f3ada3c 100644
--- a/src/MCUTempSensor.cpp
+++ b/src/MCUTempSensor.cpp
@@ -258,8 +258,10 @@
{
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+ objectServer.add_manager("/xyz/openbmc_project/sensors");
+
systemBus->request_name("xyz.openbmc_project.MCUTempSensor");
- sdbusplus::asio::object_server objectServer(systemBus);
io.post([&]() { createSensors(io, objectServer, sensors, systemBus); });
diff --git a/src/PSUSensorMain.cpp b/src/PSUSensorMain.cpp
index ab4f6f3..d9989a0 100644
--- a/src/PSUSensorMain.cpp
+++ b/src/PSUSensorMain.cpp
@@ -1030,8 +1030,9 @@
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+ objectServer.add_manager("/xyz/openbmc_project/sensors");
systemBus->request_name("xyz.openbmc_project.PSUSensor");
- sdbusplus::asio::object_server objectServer(systemBus);
auto sensorsChanged =
std::make_shared<boost::container::flat_set<std::string>>();