Skip to content

Commit 2eb6029

Browse files
committed
Fix getManagedObjects on ObjectManager returning no objects
Currently, when calling getManagedObjects ``` busctl call xyz.openbmc_project.State.Host \ /xyz/openbmc_project/state/host0 org.freedesktop.DBus.ObjectManager \ GetManagedObjects ``` we end up getting no objects `a{oa{sa{sv}}} 0`. This is incorrect and we technically should return the managed objects. Looking further at the spec: ``` All returned object paths are children of the object path implementing this interface, i.e. their object paths start with the ObjectManager's object path plus '/'. ``` This implies that the the path owned by the object manager should not be the hostX sub-entries but `/xyz/openbmc_project/state` Tested by building a harma image and in qemu calling introspect on each of the object paths and ensuring that we get the correct responses ``` busctl introspect xyz.openbmc_project.State.BMC \ /xyz/openbmc_project/state busctl introspect xyz.openbmc_project.State.BMC \ /xyz/openbmc_project/state/bmc0 busctl introspect xyz.openbmc_project.State.Host \ /xyz/openbmc_project/state busctl introspect xyz.openbmc_project.State.Host \ /xyz/openbmc_project/state/host0 busctl introspect xyz.openbmc_project.State.Chassis \ /xyz/openbmc_project/state busctl introspect xyz.openbmc_project.State.Chassis \ /xyz/openbmc_project/state/chassis0 ``` Also tested that we get the correct managed object ``` busctl call xyz.openbmc_project.State.Host /xyz/openbmc_project/state \ org.freedesktop.DBus.ObjectManager GetManagedObjects busctl call xyz.openbmc_project.State.BMC /xyz/openbmc_project/state \ org.freedesktop.DBus.ObjectManager GetManagedObjects busctl call xyz.openbmc_project.State.Chassis \ /xyz/openbmc_project/state \ org.freedesktop.DBus.ObjectManager GetManagedObjects ``` Change-Id: I525c8719c326cfbbe568c4f1f7fe95e3aa13c660 Signed-off-by: Amithash Prasad <[email protected]>
1 parent f566c96 commit 2eb6029

4 files changed

+7
-4
lines changed

bmc_state_manager_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int main()
1818
sdbusplus::message::object_path(objPath) / BMCName;
1919

2020
// Add sdbusplus ObjectManager.
21-
sdbusplus::server::manager_t objManager(bus, objPathInst.c_str());
21+
sdbusplus::server::manager_t objManager(bus, objPath);
2222

2323
phosphor::state::manager::BMC manager(bus, objPathInst.c_str());
2424

chassis_state_manager_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int main(int argc, char** argv)
7474
}
7575

7676
// Add sdbusplus ObjectManager.
77-
sdbusplus::server::manager_t objManager(bus, objPathInst.c_str());
77+
sdbusplus::server::manager_t objManager(bus, objPath);
7878
phosphor::state::manager::Chassis manager(bus, objPathInst.c_str(),
7979
chassisId);
8080

host_state_manager_main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int main(int argc, char** argv)
6767
}
6868

6969
// Add sdbusplus ObjectManager.
70-
sdbusplus::server::manager_t objManager(bus, objPathInst.c_str());
70+
sdbusplus::server::manager_t objManager(bus, objPath);
7171

7272
phosphor::state::manager::Host manager(bus, objPathInst.c_str(), hostId);
7373

hypervisor_state_manager_main.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include <cstdlib>
88

9+
using HostState = sdbusplus::server::xyz::openbmc_project::state::Host;
10+
911
int main()
1012
{
1113
auto bus = sdbusplus::bus::new_default();
@@ -14,7 +16,8 @@ int main()
1416
auto objPathInst = std::string{HYPERVISOR_OBJPATH} + '0';
1517

1618
// Add sdbusplus ObjectManager.
17-
sdbusplus::server::manager_t objManager(bus, objPathInst.c_str());
19+
sdbusplus::server::manager_t objManager(bus,
20+
HostState::namespace_path::value);
1821

1922
phosphor::state::manager::Hypervisor manager(bus, objPathInst.c_str());
2023

0 commit comments

Comments
 (0)