bmcweb: Redfish make CpuCoreCount optional
Fixes #18
This commit makes CPU core count an optional parameter. Previously it
was used to determine if a slot was populated, which was a bad idea in
the first place. This just makes the implementation a little less bad.
The best implementation would likely be to implement the state interface
in all the processor daemons to tell if the processor is present or not.
Because the processor not being present isn't very common, this is
likely low priority.
Change-Id: I42e49ef5ae7d6184d7f854069fd9a18c7c606dd3
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/redfish-core/lib/cpudimm.hpp b/redfish-core/lib/cpudimm.hpp
index ef73150..ca2f164 100644
--- a/redfish-core/lib/cpudimm.hpp
+++ b/redfish-core/lib/cpudimm.hpp
@@ -86,31 +86,29 @@
aResp->res.jsonValue["Name"] = "Processor";
const auto coresCountProperty =
properties.find("ProcessorCoreCount");
- if (coresCountProperty == properties.end())
+ if (coresCountProperty != properties.end())
{
- // Important property not in result
- messages::internalError(aResp->res);
- return;
- }
- const uint16_t *coresCount =
- sdbusplus::message::variant_ns::get_if<uint16_t>(
- &coresCountProperty->second);
- if (coresCount == nullptr)
- {
- // Important property not in desired type
- messages::internalError(aResp->res);
- return;
- }
- if (*coresCount == 0)
- {
- // Slot is not populated, set status end return
- aResp->res.jsonValue["Status"]["State"] = "Absent";
- aResp->res.jsonValue["Status"]["Health"] = "OK";
- // HTTP Code will be set up automatically, just return
- return;
+ const uint16_t *coresCount =
+ sdbusplus::message::variant_ns::get_if<uint16_t>(
+ &coresCountProperty->second);
+ if (coresCount == nullptr)
+ {
+ // Important property not in desired type
+ messages::internalError(aResp->res);
+ return;
+ }
+ if (*coresCount == 0)
+ {
+ // Slot is not populated, set status end return
+ aResp->res.jsonValue["Status"]["State"] = "Absent";
+ aResp->res.jsonValue["Status"]["Health"] = "OK";
+ // HTTP Code will be set up automatically, just return
+ return;
+ }
+
+ aResp->res.jsonValue["TotalCores"] = *coresCount;
}
- aResp->res.jsonValue["TotalCores"] = *coresCount;
aResp->res.jsonValue["Status"]["State"] = "Enabled";
aResp->res.jsonValue["Status"]["Health"] = "OK";