diff options
author | James Feist <james.feist@linux.intel.com> | 2020-06-05 23:30:51 +0300 |
---|---|---|
committer | James Feist <james.feist@linux.intel.com> | 2020-06-10 20:06:20 +0300 |
commit | 35e257a6938c5b853ff074658ac35823a2eded24 (patch) | |
tree | 890dbf01055a6500e22ca190ff7abec2194b5907 /redfish-core | |
parent | 9dc5074146a5d909c198d6e66f7ec9a0beae2d43 (diff) | |
download | bmcweb-35e257a6938c5b853ff074658ac35823a2eded24.tar.xz |
Memory: add health support
This adds health support to dimms. It also updates
the health object to look for an individual inventory
items health.
Tested:
Validator passed
{
"@odata.id": "/redfish/v1/Systems/system/Memory/memory_device11",
"@odata.type": "#Memory.v1_6_0.Memory",
"CapacityMiB": 129728,
"DataWidthBits": 64,
"Id": "memory_device11",
"Manufacturer": "Intel",
"MemoryDeviceType": "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.Logical",
"Name": "DIMM Slot",
"PartNumber": "",
"SerialNumber": "",
"Status": {
"Health": "Critical",
"HealthRollup": "Critical",
"State": "Enabled"
}
}
Change-Id: If2e1450b4228036f00ff78e6484e8da409a8039b
Signed-off-by: James Feist <james.feist@linux.intel.com>
Diffstat (limited to 'redfish-core')
-rw-r--r-- | redfish-core/lib/cpudimm.hpp | 6 | ||||
-rw-r--r-- | redfish-core/lib/health.hpp | 18 |
2 files changed, 23 insertions, 1 deletions
diff --git a/redfish-core/lib/cpudimm.hpp b/redfish-core/lib/cpudimm.hpp index a4d882201a..5f6baa3e94 100644 --- a/redfish-core/lib/cpudimm.hpp +++ b/redfish-core/lib/cpudimm.hpp @@ -15,6 +15,8 @@ */ #pragma once +#include "health.hpp" + #include <boost/container/flat_map.hpp> #include <node.hpp> #include <utils/json_utils.hpp> @@ -379,6 +381,10 @@ void getDimmDataByService(std::shared_ptr<AsyncResp> aResp, const std::string &dimmId, const std::string &service, const std::string &objPath) { + auto health = std::make_shared<HealthPopulate>(aResp); + health->selfPath = objPath; + health->populate(); + BMCWEB_LOG_DEBUG << "Get available system components."; crow::connections::systemBus->async_method_call( [dimmId, aResp{std::move(aResp)}]( diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp index fe65ebfbcb..b9f2e38635 100644 --- a/redfish-core/lib/health.hpp +++ b/redfish-core/lib/health.hpp @@ -56,9 +56,11 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate> for (const auto &[path, interfaces] : statuses) { bool isChild = false; + bool isSelf = + selfPath ? boost::starts_with(path.str, *selfPath) : false; // managers inventory is all the inventory, don't skip any - if (!isManagersHealth) + if (!isManagersHealth && !isSelf) { // We only want to look at this association if either the path @@ -133,6 +135,11 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate> else if (boost::ends_with(path.str, "critical")) { rollup = "Critical"; + if (isSelf) + { + health = "Critical"; + return; + } } else if (boost::ends_with(path.str, "warning")) { @@ -140,6 +147,11 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate> { rollup = "Warning"; } + + if (isSelf) + { + health = "Warning"; + } } } } @@ -211,6 +223,10 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate> // destroyed last, and they need not call populate() std::vector<std::shared_ptr<HealthPopulate>> children; + // self is used if health is for an individual items status, as this is the + // 'lowest most' item, the rollup will equal the health + std::optional<std::string> selfPath; + std::vector<std::string> inventory; bool isManagersHealth = false; dbus::utility::ManagedObjectType statuses; |