managers: allow starting state
Query d-bus broker, and if the state is less than
100%, set the bmc state to "Starting".
Tested: Had application that was failing on system,
queried broker and saw Progres was set to 0.97, bmcweb
reported "State": "Starting". Disabled that app, and
state went to "Enabled".
Change-Id: I4123d2f4a6388aff6891a5a02aa98b7a89777d5f
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 6d3cc92..bb9a6ac 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1565,6 +1565,7 @@
"xyz.openbmc_project.Software.BMC.Updater",
"/xyz/openbmc_project/software",
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
+
auto pids = std::make_shared<GetPIDValues>(asyncResp);
pids->run();
@@ -1574,6 +1575,39 @@
aRsp->res.jsonValue["Links"]["ManagerForChassis"] = {
{{"@odata.id", "/redfish/v1/Chassis/" + chassisId}}};
});
+
+ static bool started = false;
+
+ if (!started)
+ {
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const std::variant<double>& resp) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "Error while getting progress";
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ const double* val = std::get_if<double>(&resp);
+ if (val == nullptr)
+ {
+ BMCWEB_LOG_ERROR
+ << "Invalid response while getting progress";
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ if (*val < 1.0)
+ {
+ asyncResp->res.jsonValue["Status"]["State"] =
+ "Starting";
+ started = true;
+ }
+ },
+ "org.freedesktop.systemd1", "/org/freedesktop/systemd1",
+ "org.freedesktop.DBus.Properties", "Get",
+ "org.freedesktop.systemd1.Manager", "Progress");
+ }
}
void doPatch(crow::Response& res, const crow::Request& req,