diff options
author | Hieu Huynh <hieuh@os.amperecomputing.com> | 2022-10-07 12:41:46 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-10-10 19:53:09 +0300 |
commit | b6d5d45ce974b4cc3dce0f524843da4ac6e5f7f8 (patch) | |
tree | 5cd9a1e4ed36065880b002e018374d38675e60bd | |
parent | bb759e3aeaadfec9f3aac4485f253bcc8a523e4c (diff) | |
download | bmcweb-b6d5d45ce974b4cc3dce0f524843da4ac6e5f7f8.tar.xz |
Adds LastStateTime in Redfish BootProgress
The LastStateTime is the last time the BootProgress property was
updated. It is defined by BootProgressUpdate D-bus [1].
This commit is to support this.
[1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml//xyz/openbmc_project/State/Boot/Progress.interface.yaml#L11
Tested:
1. Set boot progress code
# ipmitool raw 0x2c 0x02 0xae 0x01 0x00 0x00 0x00 0x00 0x10 0x01 \
0x00 0x00
2. Check the progress code from the Redfish interface
"BootProgress": {
"LastState": "OEM",
"LastStateTime": "2022-10-10T04:21:08.416796+00:00"
}
Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com>
Change-Id: I0834887e159970d5775dbfbf7753196b1e1cec29
-rw-r--r-- | redfish-core/lib/systems.hpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index fc5a8048ad..caf6a292ca 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -856,6 +856,40 @@ inline void getBootProgress(const std::shared_ptr<bmcweb::AsyncResp>& aResp) } /** + * @brief Retrieves boot progress Last Update of the system + * + * @param[in] aResp Shared pointer for generating response message. + * + * @return None. + */ +inline void getBootProgressLastStateTime( + const std::shared_ptr<bmcweb::AsyncResp>& aResp) +{ + sdbusplus::asio::getProperty<uint64_t>( + *crow::connections::systemBus, "xyz.openbmc_project.State.Host", + "/xyz/openbmc_project/state/host0", + "xyz.openbmc_project.State.Boot.Progress", "BootProgressLastUpdate", + [aResp](const boost::system::error_code ec, + const uint64_t lastStateTime) { + if (ec) + { + BMCWEB_LOG_DEBUG << "D-BUS response error " << ec; + return; + } + + // BootProgressLastUpdate is the last time the BootProgress property + // was updated. The time is the Epoch time, number of microseconds + // since 1 Jan 1970 00::00::00 UTC." + // https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/ + // yaml/xyz/openbmc_project/State/Boot/Progress.interface.yaml#L11 + + // Convert to ISO 8601 standard + aResp->res.jsonValue["BootProgress"]["LastStateTime"] = + redfish::time_utils::getDateTimeUintUs(lastStateTime); + }); +} + +/** * @brief Retrieves boot override type over DBUS and fills out the response * * @param[in] aResp Shared pointer for generating response message. @@ -2991,6 +3025,7 @@ inline void requestRoutesSystems(App& app) getHostState(asyncResp); getBootProperties(asyncResp); getBootProgress(asyncResp); + getBootProgressLastStateTime(asyncResp); getPCIeDeviceList(asyncResp, "PCIeDevices"); getHostWatchdogTimer(asyncResp); getPowerRestorePolicy(asyncResp); |