Set state to Absent on Present == false
- State=Absent means this function or resource is either not present
or detected.
- State=Disabled means that the device exists, but has been disabled.
Tested:
Redfish Validator Passed
Verified that absence of Drive shows [Status][State] = "Absent"
```
wget -qO- http://localhost:80/redfish/v1/Chassis/mychassis/Drives/Drive_0
{
"@odata.id": "/redfish/v1/Chassis/mychassis/Drives/Drive_0",
"@odata.type": "#Drive.v1_7_0.Drive",
"Id": "Drive_0",
"Links": {
"Chassis": {
"@odata.id": "/redfish/v1/Chassis/mychassis"
}
},
.....,
.....,
.....,
"Protocol": "....",
"Status": {
"State": "Absent"
}
}
```
Change-Id: I99217c1c3c94df5c10fb158d3d1ef65d70d0ebb3
Signed-off-by: Willy Tu <wltu@google.com>
Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com>
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index aaed634..35cd6e1 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -166,17 +166,17 @@
*crow::connections::systemBus, connectionName, path,
"xyz.openbmc_project.Inventory.Item", "Present",
[asyncResp, index](const boost::system::error_code ec2,
- bool enabled) {
+ bool isPresent) {
// this interface isn't necessary, only check it
// if we get a good return
if (ec2)
{
return;
}
- if (!enabled)
+ if (!isPresent)
{
asyncResp->res.jsonValue["StorageControllers"][index]
- ["Status"]["State"] = "Disabled";
+ ["Status"]["State"] = "Absent";
}
});
@@ -343,7 +343,7 @@
*crow::connections::systemBus, connectionName, path,
"xyz.openbmc_project.Inventory.Item", "Present",
[asyncResp, path](const boost::system::error_code ec,
- const bool enabled) {
+ const bool isPresent) {
// this interface isn't necessary, only check it if
// we get a good return
if (ec)
@@ -351,9 +351,9 @@
return;
}
- if (!enabled)
+ if (!isPresent)
{
- asyncResp->res.jsonValue["Status"]["State"] = "Disabled";
+ asyncResp->res.jsonValue["Status"]["State"] = "Absent";
}
});
}