diff options
author | Kuiying Wang <kuiying.wang@intel.com> | 2020-07-07 05:18:32 +0300 |
---|---|---|
committer | Kuiying Wang <kuiying.wang@intel.com> | 2020-07-09 05:46:47 +0300 |
commit | 3e9e72eb896f80d5d7e7b1225477af62c4a82892 (patch) | |
tree | 5783430f9a83328aa21877ace5a032584a3b7593 /redfish-core/lib/sensors.hpp | |
parent | b99fb1a9b8f4694a4b765e3f55b5bf29adf303de (diff) | |
download | bmcweb-3e9e72eb896f80d5d7e7b1225477af62c4a82892.tar.xz |
Fix -1 issue when fan collection size is 0.
When fan collection size is 0, the MinNumNeeded shown -1
(4294967295/0xffffffff) but not 0.
"Redundancy": [
{
"@odata.id": "/redfish/v1/Chassis/WC_Baseboard/Thermal#/Redundancy/0",
"@odata.type": "#Redundancy.v1_3_2.Redundancy",
"MemberId": "Tach",
"MinNumNeeded": 4294967295,
"Mode": "N+m",
"Name": "Tach",
"RedundancySet": [],
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
Tested:
"MinNumNeeded" is 0 correctly.
https://bmc_ip/redfish/v1/Chassis/WC_Baseboard/Thermal
"Redundancy": [
{
"@odata.id": "/redfish/v1/Chassis/WC_Baseboard/Thermal#/Redundancy/0",
"@odata.type": "#Redundancy.v1_3_2.Redundancy",
"MemberId": "Tach",
"MinNumNeeded": 0,
"Mode": "N+m",
"Name": "Tach",
"RedundancySet": [],
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
Change-Id: I8bf01dacd705e5309c161c5f04289d2df45ca583
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
Diffstat (limited to 'redfish-core/lib/sensors.hpp')
-rw-r--r-- | redfish-core/lib/sensors.hpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 212a4a4125..f12bbe0669 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -1208,6 +1208,10 @@ static void } } + size_t minNumNeeded = + collection->size() > 0 + ? collection->size() - *allowedFailures + : 0; nlohmann::json& jResp = sensorsAsyncResp->res .jsonValue["Redundancy"]; @@ -1220,8 +1224,7 @@ static void std::to_string(jResp.size())}, {"@odata.type", "#Redundancy.v1_3_2.Redundancy"}, - {"MinNumNeeded", - collection->size() - *allowedFailures}, + {"MinNumNeeded", minNumNeeded}, {"MemberId", name}, {"Mode", "N+m"}, {"Name", name}, |