diff options
-rw-r--r-- | config/bmcweb_config.h.in | 1 | ||||
-rw-r--r-- | config/meson.build | 2 | ||||
-rw-r--r-- | meson_options.txt | 11 | ||||
-rw-r--r-- | redfish-core/lib/systems.hpp | 111 |
4 files changed, 83 insertions, 42 deletions
diff --git a/config/bmcweb_config.h.in b/config/bmcweb_config.h.in index 1290bd652f..df16bc1a07 100644 --- a/config/bmcweb_config.h.in +++ b/config/bmcweb_config.h.in @@ -19,4 +19,5 @@ constexpr const char* bmcwebLoggingLevel = "@BMCWEB_LOGGING_LEVEL@"; constexpr const bool bmcwebEnableHealthPopulate = @BMCWEB_ENABLE_HEALTH_POPULATE@ == 1; +constexpr const bool bmcwebEnableProcMemStatus = @BMCWEB_ENABLE_PROC_MEM_STATUS@ == 1; // clang-format on diff --git a/config/meson.build b/config/meson.build index bd8aada7c1..6464024e05 100644 --- a/config/meson.build +++ b/config/meson.build @@ -15,6 +15,8 @@ conf_data.set('HTTPS_PORT', get_option('https_port')) conf_data.set('HTTPS_PORT', get_option('https_port')) enable_health_populate = get_option('health-populate') conf_data.set10('BMCWEB_ENABLE_HEALTH_POPULATE', enable_health_populate.enabled()) +enable_proc_mem_status = get_option('redfish-enable-proccessor-memory-status') +conf_data.set10('BMCWEB_ENABLE_PROC_MEM_STATUS', enable_proc_mem_status.enabled()) # Logging level loglvlopt = get_option('bmcweb-logging') diff --git a/meson_options.txt b/meson_options.txt index 3f37f9e100..26fdecf2d4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -119,6 +119,16 @@ option( ) option( + 'redfish-enable-proccessor-memory-status', + type: 'feature', + value: 'disabled', + description: '''Enable/disable the deprecated processor and memory summary + status. The default condition is disabling the processor + and memory summary status. This option will be removed in + 1Q 2024.''' +) + +option( 'redfish-provisioning-feature', type: 'feature', value: 'disabled', @@ -333,3 +343,4 @@ option( description: '''Enables HealthPopulate and generate the Status property for the resource''' ) + diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index 8d978f1e11..573bf881db 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -203,21 +203,25 @@ inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, "xyz.openbmc_project.Inventory.Item", "Present", std::move(getCpuPresenceState)); - auto getCpuFunctionalState = [aResp](const boost::system::error_code& ec3, - const bool cpuFunctionalCheck) { - if (ec3) - { - BMCWEB_LOG_ERROR << "DBUS response error " << ec3; - return; - } - modifyCpuFunctionalState(aResp, cpuFunctionalCheck); - }; + if constexpr (bmcwebEnableProcMemStatus) + { + auto getCpuFunctionalState = + [aResp](const boost::system::error_code& ec3, + const bool cpuFunctionalCheck) { + if (ec3) + { + BMCWEB_LOG_ERROR << "DBUS response error " << ec3; + return; + } + modifyCpuFunctionalState(aResp, cpuFunctionalCheck); + }; - // Get the Functional State - sdbusplus::asio::getProperty<bool>( - *crow::connections::systemBus, service, path, - "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional", - std::move(getCpuFunctionalState)); + // Get the Functional State + sdbusplus::asio::getProperty<bool>( + *crow::connections::systemBus, service, path, + "xyz.openbmc_project.State.Decorator.OperationalStatus", + "Functional", std::move(getCpuFunctionalState)); + } sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, path, @@ -247,26 +251,30 @@ inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, */ inline void processMemoryProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& service, const std::string& path, + [[maybe_unused]] const std::string& service, + [[maybe_unused]] const std::string& path, const dbus::utility::DBusPropertiesMap& properties) { BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Dimm properties."; if (properties.empty()) { - sdbusplus::asio::getProperty<bool>( - *crow::connections::systemBus, service, path, - "xyz.openbmc_project.State." - "Decorator.OperationalStatus", - "Functional", - [aResp](const boost::system::error_code& ec3, bool dimmState) { - if (ec3) - { - BMCWEB_LOG_ERROR << "DBUS response error " << ec3; - return; - } - updateDimmProperties(aResp, dimmState); - }); + if constexpr (bmcwebEnableProcMemStatus) + { + sdbusplus::asio::getProperty<bool>( + *crow::connections::systemBus, service, path, + "xyz.openbmc_project.State." + "Decorator.OperationalStatus", + "Functional", + [aResp](const boost::system::error_code& ec3, bool dimmState) { + if (ec3) + { + BMCWEB_LOG_ERROR << "DBUS response error " << ec3; + return; + } + updateDimmProperties(aResp, dimmState); + }); + } return; } @@ -297,7 +305,11 @@ inline void aResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] = *memorySizeInKB / static_cast<size_t>(1024 * 1024) + *preValue; } - aResp->res.jsonValue["MemorySummary"]["Status"]["State"] = "Enabled"; + if constexpr (bmcwebEnableProcMemStatus) + { + aResp->res.jsonValue["MemorySummary"]["Status"]["State"] = + "Enabled"; + } } } @@ -376,16 +388,22 @@ inline void continue; } - auto memoryHealth = std::make_shared<HealthPopulate>( - aResp, "/MemorySummary/Status"_json_pointer); + std::shared_ptr<HealthPopulate> memoryHealth = nullptr; + std::shared_ptr<HealthPopulate> cpuHealth = nullptr; - auto cpuHealth = std::make_shared<HealthPopulate>( - aResp, "/ProcessorSummary/Status"_json_pointer); - - if constexpr (bmcwebEnableHealthPopulate) + if constexpr (bmcwebEnableProcMemStatus) { + memoryHealth = std::make_shared<HealthPopulate>( + aResp, "/MemorySummary/Status"_json_pointer); systemHealth->children.emplace_back(memoryHealth); - systemHealth->children.emplace_back(cpuHealth); + + if constexpr (bmcwebEnableHealthPopulate) + { + cpuHealth = std::make_shared<HealthPopulate>( + aResp, "/ProcessorSummary/Status"_json_pointer); + + systemHealth->children.emplace_back(cpuHealth); + } } // This is not system, so check if it's cpu, dimm, UUID or @@ -402,7 +420,10 @@ inline void getMemorySummary(aResp, connection.first, path); - memoryHealth->inventory.emplace_back(path); + if constexpr (bmcwebEnableProcMemStatus) + { + memoryHealth->inventory.emplace_back(path); + } } else if (interfaceName == "xyz.openbmc_project.Inventory.Item.Cpu") @@ -412,7 +433,10 @@ inline void getProcessorSummary(aResp, connection.first, path); - cpuHealth->inventory.emplace_back(path); + if constexpr (bmcwebEnableProcMemStatus) + { + cpuHealth->inventory.emplace_back(path); + } } else if (interfaceName == "xyz.openbmc_project.Common.UUID") { @@ -3054,10 +3078,13 @@ inline void requestRoutesSystems(App& app) asyncResp->res.jsonValue["SystemType"] = "Physical"; asyncResp->res.jsonValue["Description"] = "Computer System"; asyncResp->res.jsonValue["ProcessorSummary"]["Count"] = 0; - asyncResp->res.jsonValue["ProcessorSummary"]["Status"]["State"] = - "Disabled"; - asyncResp->res.jsonValue["MemorySummary"]["Status"]["State"] = - "Disabled"; + if constexpr (bmcwebEnableProcMemStatus) + { + asyncResp->res.jsonValue["ProcessorSummary"]["Status"]["State"] = + "Disabled"; + asyncResp->res.jsonValue["MemorySummary"]["Status"]["State"] = + "Disabled"; + } asyncResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] = uint64_t(0); asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system"; |