diff options
author | James Feist <james.feist@linux.intel.com> | 2019-10-22 02:10:49 +0300 |
---|---|---|
committer | James Feist <james.feist@linux.intel.com> | 2019-10-24 02:18:58 +0300 |
commit | 22984074fa0ec13967fe95b93282de2294411c6b (patch) | |
tree | 54020d0215697049c9694b08a1f2c3cdeaf00d03 /redfish-core/lib/storage.hpp | |
parent | a25aeccf45933dbccfd68c633d0ae13ddd3e1962 (diff) | |
download | bmcweb-22984074fa0ec13967fe95b93282de2294411c6b.tar.xz |
Add Rebuilding to Drives
When the xyz.openbmc_project.Drive.State has rebuilding
set true, make the state Updating.
Tested:
{
"@odata.context": "/redfish/v1/$metadata#Drive.Drive",
"@odata.id": "/redfish/v1/Systems/system/Storage/1/Drive/Drive_1",
"@odata.type": "#Drive.v1_2_0.Drive",
"Id": "Drive_1",
"Manufacturer": "INTEL",
"Model": "P4800X",
"Name": "Drive_1",
"PartNumber": "INTEL SSDPE21K375GA",
"SerialNumber": "PHKE722600NL375AGN",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Updating"
}
}
Change-Id: I401e5a8c416d969831cebde8b5b0723f41c3e1c7
Signed-off-by: James Feist <james.feist@linux.intel.com>
Diffstat (limited to 'redfish-core/lib/storage.hpp')
-rw-r--r-- | redfish-core/lib/storage.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp index 3c4fe4c543..5554839c37 100644 --- a/redfish-core/lib/storage.hpp +++ b/redfish-core/lib/storage.hpp @@ -274,6 +274,35 @@ class Drive : public Node }, connectionName, path, "org.freedesktop.DBus.Properties", "Get", "xyz.openbmc_project.Inventory.Item", "Present"); + + crow::connections::systemBus->async_method_call( + [asyncResp](const boost::system::error_code ec, + const std::variant<bool> rebuilding) { + // this interface isn't necessary, only check it if we + // get a good return + if (ec) + { + return; + } + const bool *updating = std::get_if<bool>(&rebuilding); + if (updating == nullptr) + { + BMCWEB_LOG_DEBUG << "Illegal property present"; + messages::internalError(asyncResp->res); + return; + } + + // updating and disabled in the backend shouldn't be + // able to be set at the same time, so we don't need to + // check for the race condition of these two calls + if ((*updating)) + { + asyncResp->res.jsonValue["Status"]["State"] = + "Updating"; + } + }, + connectionName, path, "org.freedesktop.DBus.Properties", + "Get", "xyz.openbmc_project.State.Drive", "Rebuilding"); }, "xyz.openbmc_project.ObjectMapper", "/xyz/openbmc_project/object_mapper", |