diff options
| author | James Feist <james.feist@linux.intel.com> | 2019-06-10 14:15:53 -0700 |
|---|---|---|
| committer | James Feist <james.feist@linux.intel.com> | 2019-06-14 09:28:02 -0700 |
| commit | 0f6b00bded6e4c4b4e1577644e52cc33cb73bb2d (patch) | |
| tree | fc0e586c2fb5f279d04fc9fc0d9f929f90012f8f | |
| parent | 97d2a47ddc8f11f796e4f4eba48423a8fba732c2 (diff) | |
| download | bmcweb-0f6b00bded6e4c4b4e1577644e52cc33cb73bb2d.tar.gz bmcweb-0f6b00bded6e4c4b4e1577644e52cc33cb73bb2d.zip | |
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>
| -rw-r--r-- | redfish-core/lib/managers.hpp | 34 |
1 files changed, 34 insertions, 0 deletions
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 @@ class Manager : public Node "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 @@ class Manager : public Node 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, |

