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>
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 3c4fe4c..5554839 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -274,6 +274,35 @@
},
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",