DBUS service name numbering for single and multi hosts
For single host based systems additional busname is added
with "0" at the end of the name. Dbus service name of single hosts is
created with and without numbering.
in case of multiple hosts dbus service name will be postfixed with
respective host number.
ex :
single host : xyz.openbmc_project.State.Host and
xyz.openbmc_project.State.Host0
multi host : xyz.openbmc_project.State.Host1, xxx.State.Host2 ... etc
TESTED: Tested and verified in Tiogapass and YosemteV2.
verified using power control busctl commands.
Signed-off-by: Naveen Moses <naveen.mosess@hcl.com>
Change-Id: I51ba1362664dd5582b156a84d31b2403d10411b1
diff --git a/power-control-x86/src/power_control.cpp b/power-control-x86/src/power_control.cpp
index 58e7a8b..f0bdd3b 100644
--- a/power-control-x86/src/power_control.cpp
+++ b/power-control-x86/src/power_control.cpp
@@ -263,12 +263,12 @@
}
static void logStateTransition(const PowerState state)
{
- std::string logMsg =
- "Host0: Moving to \"" + getPowerStateName(state) + "\" state";
+ std::string logMsg = "Host" + node + ": Moving to \"" +
+ getPowerStateName(state) + "\" state";
phosphor::logging::log<phosphor::logging::level::INFO>(
logMsg.c_str(),
phosphor::logging::entry("STATE=%s", getPowerStateName(state).c_str()),
- phosphor::logging::entry("HOST=0"));
+ phosphor::logging::entry("HOST=%s", node.c_str()));
}
enum class Event
@@ -3106,6 +3106,22 @@
std::string errMsg = "Host" + node + ": " + "Error in Parsing...";
phosphor::logging::log<phosphor::logging::level::ERR>(errMsg.c_str());
}
+ /* Currently for single host based systems additional busname is added
+ with "0" at the end of the name ex : xyz.openbmc_project.State.Host0.
+ Going forward for single hosts the old bus name without zero numbering
+ will be removed when all other applications adapted to the
+ bus name with zero numbering (xyz.openbmc_project.State.Host0). */
+
+ if (node == "0")
+ {
+ // Request all the dbus names
+ conn->request_name(hostDbusName.c_str());
+ conn->request_name(chassisDbusName.c_str());
+ conn->request_name(osDbusName.c_str());
+ conn->request_name(buttonDbusName.c_str());
+ conn->request_name(nmiDbusName.c_str());
+ conn->request_name(rstCauseDbusName.c_str());
+ }
hostDbusName = "xyz.openbmc_project.State.Host" + node;
chassisDbusName = "xyz.openbmc_project.State.Chassis" + node;
@@ -3390,7 +3406,6 @@
hostIface =
hostServer.add_interface("/xyz/openbmc_project/state/host" + node,
"xyz.openbmc_project.State.Host");
-
// Interface for IPMI/Redfish initiated host state transitions
hostIface->register_property(
"RequestedHostTransition",
@@ -3898,7 +3913,7 @@
// Restart Cause Interface
restartCauseIface = restartCauseServer.add_interface(
- "/xyz/openbmc_project/control/host0/restart_cause",
+ "/xyz/openbmc_project/control/host" + node + "/restart_cause",
"xyz.openbmc_project.Control.Host.RestartCause");
restartCauseIface->register_property(