scheduled-host-transition: make backward compatible
Similar to what was done with the host and chassis code, ensure the old
d-bus service name, xyz.openbmc_project.State.ScheduledHostTransition,
is registered when the host instance is 0.
This ensures any code or tools that had hard coded the service name
prior to the instance based support continue to work
Tested:
- Confirmed with this change that both
xyz.openbmc_project.State.ScheduledHostTransition and
xyz.openbmc_project.State.ScheduledHostTransition0 work
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I1fb5ca622db01c931d70461d0ab4847c890b6df7
diff --git a/scheduled_host_transition_main.cpp b/scheduled_host_transition_main.cpp
index 7e02f8d..0962bda 100644
--- a/scheduled_host_transition_main.cpp
+++ b/scheduled_host_transition_main.cpp
@@ -56,6 +56,13 @@
phosphor::state::manager::ScheduledHostTransition manager(
bus, objPathInst.c_str(), hostId, event);
+ // For backwards compatibility, request a busname without host id if
+ // input id is 0.
+ if (hostId == 0)
+ {
+ bus.request_name(SCHEDULED_HOST_TRANSITION_BUSNAME);
+ }
+
bus.request_name((std::string{SCHEDULED_HOST_TRANSITION_BUSNAME} +
std::to_string(hostId))
.c_str());