bmcweb: health: Add option to disable health-populate
The Health populate calls GetManagedObjects at `/` which can take a lot
of time. Add the option to disable to improve performance if it is not
needed.
Tested:
```
$ meson build -Dhealth-populate=disabled
...
User defined options
backend : ninja
health-populate : disabled
```
Build passed.
Health Status removed. Some resource still create HealthPopulate, but
does not populate. It will require further refactoring to clean it out.
Testing on `/redfish/v1/Chassis?$expand=.($levels=1)`
On 14 chassis, from about 2.5 seconds to 400 ms. :)
Before:
```
Getting times for chassis
Getting good line count with wget -q -O- localhost:80/redfish/v1/Chassis?$expand=.($levels=1)
Line count: 980
17:05:56: real 0m2.908s user 0m0.000s sys 0m0.030s
17:05:59: real 0m2.414s user 0m0.010s sys 0m0.010s
17:05:03: real 0m3.410s user 0m0.000s sys 0m0.020s
17:05:09: real 0m2.372s user 0m0.000s sys 0m0.010s
17:05:13: real 0m3.407s user 0m0.010s sys 0m0.000s
17:05:19: real 0m2.420s user 0m0.010s sys 0m0.000s
17:05:23: real 0m3.463s user 0m0.010s sys 0m0.000s
17:05:29: real 0m2.414s user 0m0.000s sys 0m0.010s
17:05:33: real 0m2.843s user 0m0.010s sys 0m0.010s
17:05:38: real 0m2.512s user 0m0.000s sys 0m0.020s
17:05:42: real 0m2.474s user 0m0.000s sys 0m0.010s
17:05:47: real 0m2.557s user 0m0.010s sys 0m0.010s
17:05:52: real 0m2.439s user 0m0.020s sys 0m0.000s
17:05:56: real 0m3.127s user 0m0.010s sys 0m0.000s
17:05:01: real 0m2.563s user 0m0.020s sys 0m0.000s
17:05:06: real 0m2.392s user 0m0.020s sys 0m0.020s
17:05:10: real 0m2.405s user 0m0.020s sys 0m0.000s
17:05:15: real 0m2.514s user 0m0.010s sys 0m0.010s
17:05:19: real 0m2.809s user 0m0.020s sys 0m0.010s
17:05:24: real 0m2.944s user 0m0.010s sys 0m0.010s
17:05:29: real 0m2.537s user 0m0.010s sys 0m0.000s
17:05:34: real 0m3.290s user 0m0.000s sys 0m0.000s
17:05:39: real 0m2.601s user 0m0.040s sys 0m0.000s
17:05:43: real 0m2.398s user 0m0.010s sys 0m0.040s
17:05:48: real 0m2.664s user 0m0.000s sys 0m0.020s
17:05:53: real 0m2.323s user 0m0.010s sys 0m0.000s
17:05:57: real 0m3.033s user 0m0.000s sys 0m0.010s
17:05:02: real 0m3.243s user 0m0.000s sys 0m0.010s
17:05:07: real 0m2.604s user 0m0.010s sys 0m0.010s
17:05:12: real 0m2.813s user 0m0.010s sys 0m0.010s
17:05:17: real 0m2.325s user 0m0.020s sys 0m0.000s
17:05:21: real 0m2.577s user 0m0.010s sys 0m0.000s
17:05:26: real 0m2.882s user 0m0.030s sys 0m0.000s
17:05:31: real 0m2.572s user 0m0.000s sys 0m0.020s
17:05:35: real 0m2.678s user 0m0.010s sys 0m0.010s
17:05:40: real 0m2.656s user 0m0.010s sys 0m0.010s
17:05:45: real 0m2.921s user 0m0.020s sys 0m0.000s
17:05:49: real 0m2.723s user 0m0.000s sys 0m0.020s
17:05:54: real 0m2.910s user 0m0.010s sys 0m0.010s
17:05:59: real 0m2.601s user 0m0.020s sys 0m0.000s
17:05:04: real 0m2.615s user 0m0.000s sys 0m0.000s
```
After:
```
Getting times for chassis
Getting good line count with wget -q -O- localhost:80/redfish/v1/Chassis?$expand=.($levels=1)
Line count: 980
16:04:43: real 0m0.188s user 0m0.020s sys 0m0.000s
16:04:43: real 0m0.195s user 0m0.010s sys 0m0.000s
16:04:45: real 0m0.219s user 0m0.010s sys 0m0.000s
16:04:48: real 0m0.226s user 0m0.020s sys 0m0.000s
16:04:50: real 0m0.208s user 0m0.020s sys 0m0.010s
16:04:52: real 0m0.226s user 0m0.010s sys 0m0.010s
16:04:54: real 0m0.419s user 0m0.000s sys 0m0.010s
16:04:57: real 0m0.222s user 0m0.010s sys 0m0.020s
16:04:59: real 0m0.194s user 0m0.000s sys 0m0.010s
16:04:01: real 0m0.191s user 0m0.010s sys 0m0.010s
16:04:04: real 0m0.276s user 0m0.010s sys 0m0.020s
16:04:06: real 0m0.183s user 0m0.020s sys 0m0.000s
16:04:08: real 0m0.193s user 0m0.040s sys 0m0.000s
16:04:10: real 0m0.406s user 0m0.020s sys 0m0.010s
16:04:13: real 0m0.317s user 0m0.000s sys 0m0.000s
16:04:15: real 0m0.442s user 0m0.005s sys 0m0.005s
16:04:18: real 0m0.226s user 0m0.010s sys 0m0.000s
16:04:20: real 0m0.217s user 0m0.020s sys 0m0.000s
16:04:22: real 0m0.200s user 0m0.010s sys 0m0.030s
16:04:24: real 0m0.423s user 0m0.010s sys 0m0.010s
16:04:27: real 0m0.203s user 0m0.020s sys 0m0.010s
16:04:29: real 0m0.433s user 0m0.000s sys 0m0.000s
16:04:31: real 0m0.318s user 0m0.020s sys 0m0.000s
16:04:34: real 0m1.206s user 0m0.000s sys 0m0.010s
16:04:37: real 0m0.403s user 0m0.000s sys 0m0.020s
16:04:39: real 0m0.353s user 0m0.010s sys 0m0.000s
16:04:42: real 0m0.291s user 0m0.000s sys 0m0.030s
16:04:44: real 0m0.742s user 0m0.020s sys 0m0.010s
16:04:47: real 0m0.369s user 0m0.010s sys 0m0.000s
16:04:49: real 0m0.215s user 0m0.020s sys 0m0.000s
16:04:52: real 0m0.204s user 0m0.000s sys 0m0.010s
16:04:54: real 0m0.418s user 0m0.000s sys 0m0.000s
16:04:56: real 0m0.215s user 0m0.000s sys 0m0.010s
16:04:58: real 0m0.202s user 0m0.010s sys 0m0.010s
16:04:01: real 0m0.202s user 0m0.010s sys 0m0.010s
16:04:03: real 0m0.212s user 0m0.010s sys 0m0.000s
16:04:05: real 0m0.694s user 0m0.010s sys 0m0.010s
16:04:08: real 0m0.201s user 0m0.010s sys 0m0.010s
16:04:10: real 0m0.230s user 0m0.000s sys 0m0.020s
16:04:12: real 0m0.206s user 0m0.010s sys 0m0.010s
16:04:15: real 0m0.446s user 0m0.010s sys 0m0.010s
```
Google-Bug-Id: 283332577
Google-Bug-Id: 283694613
Change-Id: Ie3495b1ca09a15482b1f6f3fc9c0b52b401ede29
Signed-off-by: Willy Tu <wltu@google.com>
(cherry picked from commit d287a58fdcf761f7c743d43abcfe14bd9fcc9e27)
diff --git a/recipes-phosphor/interfaces/bmcweb/0001-Expose-Systems-in-ComputerSystemCollection-by-Item.S.patch b/recipes-phosphor/interfaces/bmcweb/0001-Expose-Systems-in-ComputerSystemCollection-by-Item.S.patch
index 328ee95..dcaa17b 100644
--- a/recipes-phosphor/interfaces/bmcweb/0001-Expose-Systems-in-ComputerSystemCollection-by-Item.S.patch
+++ b/recipes-phosphor/interfaces/bmcweb/0001-Expose-Systems-in-ComputerSystemCollection-by-Item.S.patch
@@ -1,4 +1,4 @@
-From 22443dcac8ab2741fb89770faf6467790464010a Mon Sep 17 00:00:00 2001
+From 5789a8b17aacb138a17d97af65099160e546a5e4 Mon Sep 17 00:00:00 2001
From: Edward Lee <edwarddl@google.com>
Date: Mon, 17 Apr 2023 21:44:05 +0000
Subject: [PATCH] Expose Systems in ComputerSystemCollection by Item.System
@@ -95,17 +95,17 @@
Change-Id: If3330402ac5934f030d7fbe8d8c85cc45b610160
Signed-off-by: Edward Lee <edwarddl@google.com>
---
- redfish-core/lib/systems.hpp | 339 +++++++++++++++++++++--------------
- 1 file changed, 209 insertions(+), 130 deletions(-)
+ redfish-core/lib/systems.hpp | 344 +++++++++++++++++++++--------------
+ 1 file changed, 212 insertions(+), 132 deletions(-)
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
-index 029ce58a..ad6f1999 100644
+index 39439f67..779412e1 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
-@@ -2691,27 +2691,57 @@ inline void requestRoutesSystemsCollection(App& app)
+@@ -2693,27 +2693,57 @@ inline void requestRoutesSystemsCollection(App& app)
asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems";
asyncResp->res.jsonValue["Name"] = "Computer System Collection";
-
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const std::vector<std::string>& objects) {
@@ -170,7 +170,7 @@
}
});
});
-@@ -2920,6 +2950,135 @@ inline void afterPortRequest(
+@@ -2958,6 +2988,138 @@ inline void afterPortRequest(
}
}
}
@@ -249,13 +249,15 @@
+ nlohmann::json::array_t({"KVMIP"});
+
+#endif // BMCWEB_ENABLE_KVM
++
++ auto health = std::make_shared<HealthPopulate>(asyncResp);
++#ifdef HEALTH_POPULATE
+ constexpr std::array<std::string_view, 4> inventoryForSystems{
+ "xyz.openbmc_project.Inventory.Item.Dimm",
+ "xyz.openbmc_project.Inventory.Item.Cpu",
+ "xyz.openbmc_project.Inventory.Item.Drive",
+ "xyz.openbmc_project.Inventory.Item.StorageController"};
+
-+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+ dbus::utility::getSubTreePaths(
+ "/", 0, inventoryForSystems,
+ [health](const boost::system::error_code& ec,
@@ -270,6 +272,7 @@
+ });
+
+ health->populate();
++#endif
+
+ getMainChassisId(asyncResp,
+ [](const std::string& chassisId,
@@ -306,10 +309,10 @@
/**
* Systems derived class for delivering Computer Systems Schema.
*/
-@@ -2950,132 +3109,52 @@ inline void requestRoutesSystems(App& app)
+@@ -2987,134 +3149,52 @@ inline void requestRoutesSystems(App& app)
return;
}
-
+
- if (systemName != "system")
- {
- messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -385,13 +388,15 @@
- nlohmann::json::array_t({"KVMIP"});
-
-#endif // BMCWEB_ENABLE_KVM
+-
+- auto health = std::make_shared<HealthPopulate>(asyncResp);
+-#ifdef HEALTH_POPULATE
- constexpr std::array<std::string_view, 4> inventoryForSystems{
- "xyz.openbmc_project.Inventory.Item.Dimm",
- "xyz.openbmc_project.Inventory.Item.Cpu",
- "xyz.openbmc_project.Inventory.Item.Drive",
- "xyz.openbmc_project.Inventory.Item.StorageController"};
-
-- auto health = std::make_shared<HealthPopulate>(asyncResp);
- dbus::utility::getSubTreePaths(
- "/", 0, inventoryForSystems,
- [health](const boost::system::error_code& ec,
@@ -406,11 +411,11 @@
+ messages::internalError(asyncResp->res);
return;
}
-
+
- health->inventory = resp;
- });
--
- health->populate();
+-#endif
-
- getMainChassisId(asyncResp,
- [](const std::string& chassisId,
@@ -447,7 +452,7 @@
+ return;
+ }
+ }
-
+
- getLocationIndicatorActive(asyncResp);
- // TODO (Gunnar): Remove IndicatorLED after enough time has passed
- getIndicatorLedState(asyncResp);
@@ -477,8 +482,8 @@
+ std::array<const char*, 1>{
+ "xyz.openbmc_project.Inventory.Item.System"});
});
-
+
BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/")
---
-2.40.1.495.gc816e09b53d-goog
+--
+2.41.0.rc0.172.g3f132b7071-goog
diff --git a/recipes-phosphor/interfaces/bmcweb/0001-health-Add-option-to-disable-health-populate.patch b/recipes-phosphor/interfaces/bmcweb/0001-health-Add-option-to-disable-health-populate.patch
new file mode 100644
index 0000000..9ecf999
--- /dev/null
+++ b/recipes-phosphor/interfaces/bmcweb/0001-health-Add-option-to-disable-health-populate.patch
@@ -0,0 +1,368 @@
+From f5a66ae8b9c3322ab3edc8027b52f2e802c99119 Mon Sep 17 00:00:00 2001
+From: Willy Tu <wltu@google.com>
+Date: Wed, 24 May 2023 16:08:18 -0700
+Subject: [PATCH] health: Add option to disable health-populate
+
+The Health populate calls GetManagedObjects at `/` which can take a lot
+of time. Add the option to disable to improve performance if it is not
+needed.
+
+Tested:
+```
+$ meson build -Dhealth-populate=disabled
+...
+ User defined options
+ backend : ninja
+ health-populate : disabled
+```
+
+Build passed.
+
+Health Status removed. Some resource still create HealthPopulate, but
+does not populate. It will require further refactoring to clean it out.
+
+Testing on `/redfish/v1/Chassis?$expand=.($levels=1)`
+
+On 14 chassis, from about 2.5 seconds to 400 ms. :)
+
+Before:
+```
+Getting times for chassis
+Getting good line count with wget -q -O- localhost:80/redfish/v1/Chassis?$expand=.($levels=1)
+Line count: 980
+17:05:56: real 0m2.908s user 0m0.000s sys 0m0.030s
+17:05:59: real 0m2.414s user 0m0.010s sys 0m0.010s
+17:05:03: real 0m3.410s user 0m0.000s sys 0m0.020s
+17:05:09: real 0m2.372s user 0m0.000s sys 0m0.010s
+17:05:13: real 0m3.407s user 0m0.010s sys 0m0.000s
+17:05:19: real 0m2.420s user 0m0.010s sys 0m0.000s
+17:05:23: real 0m3.463s user 0m0.010s sys 0m0.000s
+17:05:29: real 0m2.414s user 0m0.000s sys 0m0.010s
+17:05:33: real 0m2.843s user 0m0.010s sys 0m0.010s
+17:05:38: real 0m2.512s user 0m0.000s sys 0m0.020s
+17:05:42: real 0m2.474s user 0m0.000s sys 0m0.010s
+17:05:47: real 0m2.557s user 0m0.010s sys 0m0.010s
+17:05:52: real 0m2.439s user 0m0.020s sys 0m0.000s
+17:05:56: real 0m3.127s user 0m0.010s sys 0m0.000s
+17:05:01: real 0m2.563s user 0m0.020s sys 0m0.000s
+17:05:06: real 0m2.392s user 0m0.020s sys 0m0.020s
+17:05:10: real 0m2.405s user 0m0.020s sys 0m0.000s
+17:05:15: real 0m2.514s user 0m0.010s sys 0m0.010s
+17:05:19: real 0m2.809s user 0m0.020s sys 0m0.010s
+17:05:24: real 0m2.944s user 0m0.010s sys 0m0.010s
+17:05:29: real 0m2.537s user 0m0.010s sys 0m0.000s
+17:05:34: real 0m3.290s user 0m0.000s sys 0m0.000s
+17:05:39: real 0m2.601s user 0m0.040s sys 0m0.000s
+17:05:43: real 0m2.398s user 0m0.010s sys 0m0.040s
+17:05:48: real 0m2.664s user 0m0.000s sys 0m0.020s
+17:05:53: real 0m2.323s user 0m0.010s sys 0m0.000s
+17:05:57: real 0m3.033s user 0m0.000s sys 0m0.010s
+17:05:02: real 0m3.243s user 0m0.000s sys 0m0.010s
+17:05:07: real 0m2.604s user 0m0.010s sys 0m0.010s
+17:05:12: real 0m2.813s user 0m0.010s sys 0m0.010s
+17:05:17: real 0m2.325s user 0m0.020s sys 0m0.000s
+17:05:21: real 0m2.577s user 0m0.010s sys 0m0.000s
+17:05:26: real 0m2.882s user 0m0.030s sys 0m0.000s
+17:05:31: real 0m2.572s user 0m0.000s sys 0m0.020s
+17:05:35: real 0m2.678s user 0m0.010s sys 0m0.010s
+17:05:40: real 0m2.656s user 0m0.010s sys 0m0.010s
+17:05:45: real 0m2.921s user 0m0.020s sys 0m0.000s
+17:05:49: real 0m2.723s user 0m0.000s sys 0m0.020s
+17:05:54: real 0m2.910s user 0m0.010s sys 0m0.010s
+17:05:59: real 0m2.601s user 0m0.020s sys 0m0.000s
+17:05:04: real 0m2.615s user 0m0.000s sys 0m0.000s
+```
+
+After:
+```
+Getting times for chassis
+Getting good line count with wget -q -O- localhost:80/redfish/v1/Chassis?$expand=.($levels=1)
+Line count: 980
+16:04:43: real 0m0.188s user 0m0.020s sys 0m0.000s
+16:04:43: real 0m0.195s user 0m0.010s sys 0m0.000s
+16:04:45: real 0m0.219s user 0m0.010s sys 0m0.000s
+16:04:48: real 0m0.226s user 0m0.020s sys 0m0.000s
+16:04:50: real 0m0.208s user 0m0.020s sys 0m0.010s
+16:04:52: real 0m0.226s user 0m0.010s sys 0m0.010s
+16:04:54: real 0m0.419s user 0m0.000s sys 0m0.010s
+16:04:57: real 0m0.222s user 0m0.010s sys 0m0.020s
+16:04:59: real 0m0.194s user 0m0.000s sys 0m0.010s
+16:04:01: real 0m0.191s user 0m0.010s sys 0m0.010s
+16:04:04: real 0m0.276s user 0m0.010s sys 0m0.020s
+16:04:06: real 0m0.183s user 0m0.020s sys 0m0.000s
+16:04:08: real 0m0.193s user 0m0.040s sys 0m0.000s
+16:04:10: real 0m0.406s user 0m0.020s sys 0m0.010s
+16:04:13: real 0m0.317s user 0m0.000s sys 0m0.000s
+16:04:15: real 0m0.442s user 0m0.005s sys 0m0.005s
+16:04:18: real 0m0.226s user 0m0.010s sys 0m0.000s
+16:04:20: real 0m0.217s user 0m0.020s sys 0m0.000s
+16:04:22: real 0m0.200s user 0m0.010s sys 0m0.030s
+16:04:24: real 0m0.423s user 0m0.010s sys 0m0.010s
+16:04:27: real 0m0.203s user 0m0.020s sys 0m0.010s
+16:04:29: real 0m0.433s user 0m0.000s sys 0m0.000s
+16:04:31: real 0m0.318s user 0m0.020s sys 0m0.000s
+16:04:34: real 0m1.206s user 0m0.000s sys 0m0.010s
+16:04:37: real 0m0.403s user 0m0.000s sys 0m0.020s
+16:04:39: real 0m0.353s user 0m0.010s sys 0m0.000s
+16:04:42: real 0m0.291s user 0m0.000s sys 0m0.030s
+16:04:44: real 0m0.742s user 0m0.020s sys 0m0.010s
+16:04:47: real 0m0.369s user 0m0.010s sys 0m0.000s
+16:04:49: real 0m0.215s user 0m0.020s sys 0m0.000s
+16:04:52: real 0m0.204s user 0m0.000s sys 0m0.010s
+16:04:54: real 0m0.418s user 0m0.000s sys 0m0.000s
+16:04:56: real 0m0.215s user 0m0.000s sys 0m0.010s
+16:04:58: real 0m0.202s user 0m0.010s sys 0m0.010s
+16:04:01: real 0m0.202s user 0m0.010s sys 0m0.010s
+16:04:03: real 0m0.212s user 0m0.010s sys 0m0.000s
+16:04:05: real 0m0.694s user 0m0.010s sys 0m0.010s
+16:04:08: real 0m0.201s user 0m0.010s sys 0m0.010s
+16:04:10: real 0m0.230s user 0m0.000s sys 0m0.020s
+16:04:12: real 0m0.206s user 0m0.010s sys 0m0.010s
+16:04:15: real 0m0.446s user 0m0.010s sys 0m0.010s
+```
+
+Patch Tracking Bug: b/283694613
+Upstream info / review: http://go/openbmccl/63730
+Upstream-Status: Submitted
+Justification: Bmcweb performance on Chassis expand bugfix(b/283332577)
+
+Change-Id: I90b242e2cd24973420de871fedf9793dd1e310f3
+Signed-off-by: Willy Tu <wltu@google.com>
+---
+ meson.build | 1 +
+ meson_options.txt | 8 ++++++++
+ redfish-core/lib/chassis.hpp | 2 ++
+ redfish-core/lib/ethernet.hpp | 8 ++++----
+ redfish-core/lib/managers.hpp | 2 ++
+ redfish-core/lib/memory.hpp | 2 ++
+ redfish-core/lib/storage.hpp | 8 ++++++++
+ redfish-core/lib/systems.hpp | 8 ++++++--
+ redfish-core/lib/task.hpp | 2 ++
+ 9 files changed, 35 insertions(+), 6 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 93ac8da9..b314253c 100644
+--- a/meson.build
++++ b/meson.build
+@@ -63,6 +63,7 @@ feature_map = {
+ 'basic-auth' : '-DBMCWEB_ENABLE_BASIC_AUTHENTICATION',
+ 'cookie-auth' : '-DBMCWEB_ENABLE_COOKIE_AUTHENTICATION',
+ 'google-api' : '-DBMCWEB_ENABLE_GOOGLE_API',
++ 'health-populate' : '-DHEALTH_POPULATE',
+ 'host-serial-socket' : '-DBMCWEB_ENABLE_HOST_SERIAL_WEBSOCKET',
+ 'ibm-management-console' : '-DBMCWEB_ENABLE_IBM_MANAGEMENT_CONSOLE',
+ 'insecure-disable-auth' : '-DBMCWEB_INSECURE_DISABLE_AUTHX',
+diff --git a/meson_options.txt b/meson_options.txt
+index 57fb8ce0..ef74cd5b 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -320,3 +320,11 @@ option(
+ enable on production systems at this time. Other query
+ parameters such as only are not controlled by this option.'''
+ )
++
++option(
++ 'health-populate',
++ type: 'feature',
++ value: 'enabled',
++ description: '''Enables HealthPopulate and generate the Status property for
++ the resource'''
++)
+diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
+index dd771951..18a5f501 100644
+--- a/redfish-core/lib/chassis.hpp
++++ b/redfish-core/lib/chassis.hpp
+@@ -250,6 +250,7 @@ inline void
+
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+
++#ifdef HEALTH_POPULATE
+ dbus::utility::getAssociationEndPoints(
+ path + "/all_sensors",
+ [health](const boost::system::error_code& ec2,
+@@ -262,6 +263,7 @@ inline void
+ });
+
+ health->populate();
++#endif
+
+ if (connectionNames.empty())
+ {
+diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
+index 95632901..c10a7359 100644
+--- a/redfish-core/lib/ethernet.hpp
++++ b/redfish-core/lib/ethernet.hpp
+@@ -1571,17 +1571,16 @@ inline void parseInterfaceData(
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data)
+ {
+- constexpr std::array<std::string_view, 1> inventoryForEthernet = {
+- "xyz.openbmc_project.Inventory.Item.Ethernet"};
+-
+ nlohmann::json& jsonResponse = asyncResp->res.jsonValue;
+ jsonResponse["Id"] = ifaceId;
+ jsonResponse["@odata.id"] = crow::utility::urlFromPieces(
+ "redfish", "v1", "Managers", "bmc", "EthernetInterfaces", ifaceId);
+ jsonResponse["InterfaceEnabled"] = ethData.nicEnabled;
+
++#ifdef HEALTH_POPULATE
++ constexpr std::array<std::string_view, 1> inventoryForEthernet = {
++ "xyz.openbmc_project.Inventory.Item.Ethernet"};
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+-
+ dbus::utility::getSubTreePaths(
+ "/", 0, inventoryForEthernet,
+ [health](const boost::system::error_code& ec,
+@@ -1595,6 +1594,7 @@ inline void parseInterfaceData(
+ });
+
+ health->populate();
++#endif
+
+ if (ethData.nicEnabled)
+ {
+diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
+index ba63dc4c..95b00f37 100644
+--- a/redfish-core/lib/managers.hpp
++++ b/redfish-core/lib/managers.hpp
+@@ -2004,9 +2004,11 @@ inline void requestRoutesManager(App& app)
+ asyncResp->res.jsonValue["Links"]["ManagerForServers"] =
+ std::move(managerForServers);
+
++#ifdef HEALTH_POPULATE
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+ health->isManagersHealth = true;
+ health->populate();
++#endif
+
+ sw_util::populateSoftwareInformation(asyncResp, sw_util::bmcPurpose,
+ "FirmwareVersion", true);
+diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
+index 44784726..b8dc0836 100644
+--- a/redfish-core/lib/memory.hpp
++++ b/redfish-core/lib/memory.hpp
+@@ -606,9 +606,11 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp,
+ const std::string& service,
+ const std::string& objPath)
+ {
++#ifdef HEALTH_POPULATE
+ auto health = std::make_shared<HealthPopulate>(aResp);
+ health->selfPath = objPath;
+ health->populate();
++#endif
+
+ BMCWEB_LOG_DEBUG << "Get available system components.";
+ sdbusplus::asio::getAllProperties(
+diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
+index 0388ccd6..69a81622 100644
+--- a/redfish-core/lib/storage.hpp
++++ b/redfish-core/lib/storage.hpp
+@@ -89,8 +89,10 @@ inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ auto& count = asyncResp->res.jsonValue["Drives@odata.count"];
+ count = 0;
+
++#ifdef HEALTH_POPULATE
+ health->inventory.insert(health->inventory.end(), driveList.begin(),
+ driveList.end());
++#endif
+
+ for (const std::string& drive : driveList)
+ {
+@@ -239,6 +241,7 @@ inline void
+ });
+ }
+
++#ifdef HEALTH_POPULATE
+ // this is done after we know the json array will no longer
+ // be resized, as json::array uses vector underneath and we
+ // need references to its members that won't change
+@@ -255,6 +258,7 @@ inline void
+ health->children.emplace_back(subHealth);
+ count++;
+ }
++#endif
+ });
+ }
+
+@@ -277,7 +281,9 @@ inline void requestRoutesStorage(App& app)
+ asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
++#ifdef HEALTH_POPULATE
+ health->populate();
++#endif
+
+ getDrives(asyncResp, health);
+ getStorageControllers(asyncResp, health);
+@@ -634,9 +640,11 @@ inline void requestRoutesDrive(App& app)
+ // default it to Enabled
+ asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+
++#ifdef HEALTH_POPULATE
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+ health->inventory.emplace_back(path);
+ health->populate();
++#endif
+
+ addAllDriveInfo(asyncResp, connectionNames[0].first, path,
+ connectionNames[0].second);
+diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
+index 029ce58a..4293250c 100644
+--- a/redfish-core/lib/systems.hpp
++++ b/redfish-core/lib/systems.hpp
+@@ -286,8 +286,10 @@ inline void
+ auto cpuHealth = std::make_shared<HealthPopulate>(
+ aResp, "/ProcessorSummary/Status"_json_pointer);
+
++#ifdef HEALTH_POPULATE
+ systemHealth->children.emplace_back(memoryHealth);
+ systemHealth->children.emplace_back(cpuHealth);
++#endif
+
+ // This is not system, so check if it's cpu, dimm, UUID or
+ // BiosVer
+@@ -3025,13 +3027,15 @@ inline void requestRoutesSystems(App& app)
+ nlohmann::json::array_t({"KVMIP"});
+
+ #endif // BMCWEB_ENABLE_KVM
++
++ auto health = std::make_shared<HealthPopulate>(asyncResp);
++#ifdef HEALTH_POPULATE
+ constexpr std::array<std::string_view, 4> inventoryForSystems{
+ "xyz.openbmc_project.Inventory.Item.Dimm",
+ "xyz.openbmc_project.Inventory.Item.Cpu",
+ "xyz.openbmc_project.Inventory.Item.Drive",
+ "xyz.openbmc_project.Inventory.Item.StorageController"};
+
+- auto health = std::make_shared<HealthPopulate>(asyncResp);
+ dbus::utility::getSubTreePaths(
+ "/", 0, inventoryForSystems,
+ [health](const boost::system::error_code& ec,
+@@ -3044,8 +3048,8 @@ inline void requestRoutesSystems(App& app)
+
+ health->inventory = resp;
+ });
+-
+ health->populate();
++#endif
+
+ getMainChassisId(asyncResp,
+ [](const std::string& chassisId,
+diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
+index 4edfe182..b8c1b98a 100644
+--- a/redfish-core/lib/task.hpp
++++ b/redfish-core/lib/task.hpp
+@@ -486,8 +486,10 @@ inline void requestRoutesTaskService(App& app)
+
+ asyncResp->res.jsonValue["LifeCycleEventOnTaskStateChange"] = true;
+
++#ifdef HEALTH_POPULATE
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+ health->populate();
++#endif
+ asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["ServiceEnabled"] = true;
+ asyncResp->res.jsonValue["Tasks"]["@odata.id"] =
+--
+2.41.0.rc0.172.g3f132b7071-goog
+
diff --git a/recipes-phosphor/interfaces/bmcweb/0001-storage-Add-Association-Support-for-Drive.patch b/recipes-phosphor/interfaces/bmcweb/0001-storage-Add-Association-Support-for-Drive.patch
index fc9f356..56ed9db 100644
--- a/recipes-phosphor/interfaces/bmcweb/0001-storage-Add-Association-Support-for-Drive.patch
+++ b/recipes-phosphor/interfaces/bmcweb/0001-storage-Add-Association-Support-for-Drive.patch
@@ -1,4 +1,4 @@
-From 573bd8032a35a3acfcc27e552144a5bcdd772e3f Mon Sep 17 00:00:00 2001
+From fc4ef4b69620bf5c0ed6c5cd47137d47d78b6015 Mon Sep 17 00:00:00 2001
From: Willy Tu <wltu@google.com>
Date: Tue, 26 Jul 2022 16:24:24 +0000
Subject: [PATCH] storage: Add Association Support for Drive
@@ -84,8 +84,8 @@
Signed-off-by: Willy Tu <wltu@google.com>
---
redfish-core/include/redfish.hpp | 1 -
- redfish-core/lib/storage.hpp | 152 +++++++++++--------------------
- 2 files changed, 55 insertions(+), 98 deletions(-)
+ redfish-core/lib/storage.hpp | 154 +++++++++++--------------------
+ 2 files changed, 55 insertions(+), 100 deletions(-)
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index 28172643..4d9f4b39 100644
@@ -100,7 +100,7 @@
requestRoutesCableCollection(app);
#ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
-index eaa0bc76..287ec111 100644
+index 33988215..cbb414e1 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -93,13 +93,17 @@ inline void requestRoutesStorageCollection(App& app)
@@ -125,7 +125,7 @@
const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreePathsResponse& driveList) {
if (ec)
-@@ -128,7 +132,7 @@ inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+@@ -130,7 +134,7 @@ inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
nlohmann::json::object_t driveJson;
driveJson["@odata.id"] = crow::utility::urlFromPieces(
@@ -134,7 +134,7 @@
object.filename());
driveArray.push_back(std::move(driveJson));
}
-@@ -137,6 +141,47 @@ inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+@@ -139,6 +143,47 @@ inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
});
}
@@ -182,7 +182,7 @@
inline void requestRoutesStorage(App& app)
{
BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Storage/<str>/")
-@@ -160,7 +205,7 @@ inline void requestRoutesStorage(App& app)
+@@ -162,7 +207,7 @@ inline void requestRoutesStorage(App& app)
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.Inventory.Item.Storage"};
dbus::utility::getSubTree(
@@ -191,16 +191,16 @@
[asyncResp, storageId](
const boost::system::error_code ec,
const dbus::utility::MapperGetSubTreeResponse& subtree) {
-@@ -198,7 +243,7 @@ inline void requestRoutesStorage(App& app)
- auto health = std::make_shared<HealthPopulate>(asyncResp);
+@@ -202,7 +247,7 @@ inline void requestRoutesStorage(App& app)
health->populate();
+ #endif
- getDrives(asyncResp, health);
+ getDriveFromChassis(asyncResp, health, storage->first);
asyncResp->res.jsonValue["Controllers"]["@odata.id"] =
crow::utility::urlFromPieces("redfish", "v1", "Systems",
"system", "Storage", storageId,
-@@ -221,7 +266,7 @@ inline void requestRoutesStorage(App& app)
+@@ -225,7 +270,7 @@ inline void requestRoutesStorage(App& app)
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.Inventory.Item.Storage"};
dbus::utility::getSubTree(
@@ -209,7 +209,7 @@
[asyncResp, storageId](
const boost::system::error_code ec,
const dbus::utility::MapperGetSubTreeResponse& subtree) {
-@@ -561,95 +606,6 @@ static void addAllDriveInfo(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+@@ -567,97 +612,6 @@ static void addAllDriveInfo(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
}
}
@@ -292,9 +292,11 @@
- // default it to Enabled
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
-
+-#ifdef HEALTH_POPULATE
- auto health = std::make_shared<HealthPopulate>(asyncResp);
- health->inventory.emplace_back(path);
- health->populate();
+-#endif
-
- addAllDriveInfo(asyncResp, connectionNames[0].first, path,
- connectionNames[0].second);
@@ -305,7 +307,7 @@
/**
* Chassis drives, this URL will show all the DriveCollection
* information
-@@ -826,7 +782,9 @@ inline void
+@@ -834,7 +788,9 @@ inline void
const dbus::utility::MapperGetSubTreeResponse& subtree) {
buildDrive(asyncResp, chassisId, driveName, ec, subtree);
});
@@ -316,5 +318,5 @@
inline void
--
-2.40.0.634.g4ca3ef3211-goog
+2.41.0.rc0.172.g3f132b7071-goog
diff --git a/recipes-phosphor/interfaces/bmcweb/0002-storage-Support-new-StorageController.patch b/recipes-phosphor/interfaces/bmcweb/0002-storage-Support-new-StorageController.patch
index 96d019e..e8980bc 100644
--- a/recipes-phosphor/interfaces/bmcweb/0002-storage-Support-new-StorageController.patch
+++ b/recipes-phosphor/interfaces/bmcweb/0002-storage-Support-new-StorageController.patch
@@ -1,4 +1,4 @@
-From c051ca3b37973fcc9b0b72eb750e32b69ff34bd2 Mon Sep 17 00:00:00 2001
+From bc177cc68ea73e77ad9e09ba655cb72a2df9f453 Mon Sep 17 00:00:00 2001
From: Willy Tu <wltu@google.com>
Date: Tue, 14 Mar 2023 11:29:50 -0700
Subject: [PATCH] storage: Support new StorageController
@@ -95,8 +95,8 @@
Signed-off-by: Willy Tu <wltu@google.com>
---
redfish-core/include/redfish.hpp | 2 +
- redfish-core/lib/storage.hpp | 398 +++++++++++++++++++------------
- 2 files changed, 250 insertions(+), 150 deletions(-)
+ redfish-core/lib/storage.hpp | 400 +++++++++++++++++++------------
+ 2 files changed, 250 insertions(+), 152 deletions(-)
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index ea2e2017..28172643 100644
@@ -112,10 +112,10 @@
requestRoutesCable(app);
requestRoutesCableCollection(app);
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
-index 047d34a7..98ec7e61 100644
+index 788df473..f419748b 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
-@@ -113,153 +113,6 @@ inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+@@ -115,155 +115,6 @@ inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
});
}
@@ -247,6 +247,7 @@
- });
- }
-
+-#ifdef HEALTH_POPULATE
- // this is done after we know the json array will no longer
- // be resized, as json::array uses vector underneath and we
- // need references to its members that won't change
@@ -263,13 +264,14 @@
- health->children.emplace_back(subHealth);
- count++;
- }
+-#endif
- });
-}
-
inline void requestRoutesStorage(App& app)
{
BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Storage/1/")
-@@ -271,7 +124,7 @@ inline void requestRoutesStorage(App& app)
+@@ -275,7 +126,7 @@ inline void requestRoutesStorage(App& app)
{
return;
}
@@ -278,8 +280,8 @@
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Systems/system/Storage/1";
asyncResp->res.jsonValue["Name"] = "Storage";
-@@ -282,7 +135,8 @@ inline void requestRoutesStorage(App& app)
- health->populate();
+@@ -288,7 +139,8 @@ inline void requestRoutesStorage(App& app)
+ #endif
getDrives(asyncResp, health);
- getStorageControllers(asyncResp, health);
@@ -288,7 +290,7 @@
});
}
-@@ -759,7 +613,7 @@ inline void chassisDriveCollectionGet(
+@@ -769,7 +621,7 @@ inline void chassisDriveCollectionGet(
asyncResp->res.jsonValue["Members@odata.count"] = resp.size();
}); // end association lambda
@@ -297,7 +299,7 @@
});
}
-@@ -915,4 +769,248 @@ inline void requestRoutesChassisDriveName(App& app)
+@@ -925,4 +777,248 @@ inline void requestRoutesChassisDriveName(App& app)
std::bind_front(handleChassisDriveGet, std::ref(app)));
}
@@ -547,5 +549,5 @@
+
} // namespace redfish
--
-2.40.1.521.gf1e218fcd8-goog
+2.41.0.rc0.172.g3f132b7071-goog
diff --git a/recipes-phosphor/interfaces/bmcweb/0004-storage-add-support-for-multiple-storages.patch b/recipes-phosphor/interfaces/bmcweb/0004-storage-add-support-for-multiple-storages.patch
index f6f6446..156f560 100644
--- a/recipes-phosphor/interfaces/bmcweb/0004-storage-add-support-for-multiple-storages.patch
+++ b/recipes-phosphor/interfaces/bmcweb/0004-storage-add-support-for-multiple-storages.patch
@@ -1,4 +1,4 @@
-From 47e243f9359498a775182ae4d668731911af1827 Mon Sep 17 00:00:00 2001
+From 08a8ccdec8d4b57ecf374c6a23193400308cbb23 Mon Sep 17 00:00:00 2001
From: Willy Tu <wltu@google.com>
Date: Tue, 26 Jul 2022 00:41:55 +0000
Subject: [PATCH] storage: add support for multiple storages
@@ -140,20 +140,19 @@
Signed-off-by: Willy Tu <wltu@google.com>
Signed-off-by: Tom Tung <shes050117@gmail.com>
Signed-off-by: Willy Tu <wltu@google.com>
-
---
redfish-core/lib/chassis.hpp | 51 ++++++++++-
redfish-core/lib/storage.hpp | 170 ++++++++++++++++++++++++++++++-----
2 files changed, 199 insertions(+), 22 deletions(-)
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
-index 709be8f5..730e1664 100644
+index d9531d9b..3a1ccfdc 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -36,6 +36,54 @@
namespace redfish
{
-
+
+/**
+ * @brief Retrieves resources over dbus to link to the chassis
+ *
@@ -205,7 +204,7 @@
/**
* @brief Retrieves chassis state properties over dbus
*
-@@ -405,7 +453,7 @@ inline void
+@@ -407,7 +455,7 @@ inline void
sdbusplus::asio::getAllProperties(
*crow::connections::systemBus, connectionName, path,
"xyz.openbmc_project.Inventory.Decorator.Asset",
@@ -214,16 +213,16 @@
const boost::system::error_code& /*ec2*/,
const dbus::utility::DBusPropertiesMap& propertiesList) {
const std::string* partNumber = nullptr;
-@@ -497,6 +545,7 @@ inline void
+@@ -499,6 +547,7 @@ inline void
asyncResp->res.jsonValue["Links"]["ManagedBy"] =
std::move(managedBy);
getChassisState(asyncResp);
+ getStorageLink(asyncResp, path);
});
-
+
bool hasChassisInterface = false;
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
-index 776bbb3f..7fd9276d 100644
+index f419748b..33988215 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -59,12 +59,36 @@ inline void requestRoutesStorageCollection(App& app)
@@ -268,9 +267,9 @@
+ interface);
});
}
-
-@@ -115,28 +139,134 @@ inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-
+
+@@ -117,30 +141,136 @@ inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+
inline void requestRoutesStorage(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Storage/1/")
@@ -298,9 +297,7 @@
+ systemName);
+ return;
+ }
-
-- auto health = std::make_shared<HealthPopulate>(asyncResp);
-- health->populate();
++
+ constexpr std::array<std::string_view, 1> interfaces = {
+ "xyz.openbmc_project.Inventory.Item.Storage"};
+ dbus::utility::getSubTree(
@@ -329,10 +326,8 @@
+ asyncResp->res, "#Storage.v1_13_0.Storage", storageId);
+ return;
+ }
-
-- getDrives(asyncResp, health);
-- asyncResp->res.jsonValue["Controllers"]["@odata.id"] =
-- "/redfish/v1/Systems/system/Storage/1/Controllers";
+
+- auto health = std::make_shared<HealthPopulate>(asyncResp);
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#Storage.v1_13_0.Storage";
+ asyncResp->res.jsonValue["@odata.id"] =
@@ -343,8 +338,14 @@
+ asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+ #ifdef HEALTH_POPULATE
+- health->populate();
+ health->populate();
-+
+ #endif
+
+- getDrives(asyncResp, health);
+- asyncResp->res.jsonValue["Controllers"]["@odata.id"] =
+- "/redfish/v1/Systems/system/Storage/1/Controllers";
+ getDrives(asyncResp, health);
+ asyncResp->res.jsonValue["Controllers"]["@odata.id"] =
+ crow::utility::urlFromPieces("redfish", "v1", "Systems",
@@ -416,8 +417,8 @@
+ });
});
}
-
-@@ -633,7 +763,6 @@ inline void buildDrive(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+
+@@ -639,7 +769,6 @@ inline void buildDrive(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const boost::system::error_code& ec,
const dbus::utility::MapperGetSubTreeResponse& subtree)
{
@@ -425,7 +426,7 @@
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
-@@ -681,7 +810,6 @@ inline void
+@@ -687,7 +816,6 @@ inline void
const std::string& driveName,
const std::vector<std::string>& resp)
{
@@ -433,3 +434,6 @@
for (const std::string& drivePath : resp)
{
sdbusplus::message::object_path path(drivePath);
+--
+2.41.0.rc0.172.g3f132b7071-goog
+
diff --git a/recipes-phosphor/interfaces/bmcweb/0023-gRPC-redfish.patch b/recipes-phosphor/interfaces/bmcweb/0023-gRPC-redfish.patch
index 1e8a97e..bf6829f 100644
--- a/recipes-phosphor/interfaces/bmcweb/0023-gRPC-redfish.patch
+++ b/recipes-phosphor/interfaces/bmcweb/0023-gRPC-redfish.patch
@@ -1,4 +1,4 @@
-From aa241cd339752f9dbbdd41d0b6169cd6ad5e15e5 Mon Sep 17 00:00:00 2001
+From 71ab66a86c69469782f1eb26a73632c90a69a211 Mon Sep 17 00:00:00 2001
From: Nan Zhou <nanzhou@google.com>
Date: Sat, 14 Jan 2023 20:34:06 +0000
Subject: [PATCH] gRPC redfish
@@ -42,7 +42,7 @@
+++ b/config/bmcweb_config.h.in
@@ -14,4 +14,7 @@ constexpr const size_t bmcwebHttpReqBodyLimitMb = @BMCWEB_HTTP_REQ_BODY_LIMIT_MB
constexpr const char* mesonInstallPrefix = "@MESON_INSTALL_PREFIX@";
-
+
constexpr const bool bmcwebInsecureEnableHttpPushStyleEventing = @BMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING@ == 1;
+constexpr int mTlsGrpcPort = @MTLS_GRPC_PORT@;
+constexpr int insecureGrpcPort = @INSECURE_GRPC_PORT@;
@@ -59,7 +59,7 @@
+conf_data.set('MTLS_GRPC_PORT', get_option('mtls-grpc-port'))
+conf_data.set('INSECURE_GRPC_PORT', get_option('insecure-grpc-port'))
+conf_data.set10('INSECURE_DISABLE_REDFISH_AUTHZ', get_option('insecure-disable-grpc-redfish-authz').enabled())
-
+
conf_h_dep = declare_dependency(
include_directories: include_directories('.'),
@@ -41,4 +44,4 @@ configure_file(input : 'pam-webserver',
@@ -126,16 +126,16 @@
+++ b/http/http_request.hpp
@@ -1,5 +1,7 @@
#pragma once
-
+
+#include "bmcweb_authorizer_singleton.h"
+
#include "common.hpp"
#include "sessions.hpp"
-
+
@@ -32,6 +34,10 @@ struct Request
-
+
std::shared_ptr<persistent_data::UserSession> session;
-
+
+ // Dynamic fine grained authorization
+ bool fromGrpc = false;
+ ::milotic::authz::BmcWebAuthorizerSingleton::RequestState authzState;
@@ -149,7 +149,7 @@
+++ b/http/http_server.hpp
@@ -1,5 +1,8 @@
#pragma once
-
+
+#include "absl/log/log.h"
+#include "bmcweb_authorizer_singleton.h"
+
@@ -191,7 +191,7 @@
+++ b/http/routing.hpp
@@ -1,5 +1,11 @@
#pragma once
-
+
+#include "absl/log/log.h"
+#include "authorizer_enums.h"
+#include "bmcweb_authorizer_singleton.h"
@@ -204,7 +204,7 @@
@@ -1509,11 +1515,30 @@ class Router
<< static_cast<uint32_t>(*verb) << " / "
<< rule.getMethods();
-
+
- if (req.session == nullptr)
+ if (!req.fromGrpc || (insecureDisableGrpcRedfishAuthz &&
+ req.authzState.peer_authenticated))
@@ -234,24 +234,24 @@
[&rule, asyncResp, params](Request& thisReq) mutable {
rule.handle(thisReq, asyncResp, params);
diff --git a/meson.build b/meson.build
-index 46ab9466..e667091b 100644
+index e0d761a1..de1b3d0b 100644
--- a/meson.build
+++ b/meson.build
-@@ -93,6 +93,10 @@ feature_map = {
+@@ -94,6 +94,10 @@ feature_map = {
#'vm-nbdproxy' : '-DBMCWEB_ENABLE_VM_NBDPROXY',
}
-
+
+# gRPC Features
+feature_map += {'mtls-grpc' : '-DBMCWEB_ENABLE_GRPC'}
+feature_map += {'insecure-grpc' : '-DBMCWEB_ENABLE_INSECURE_GRPC'}
+
# Get the options status and build a project summary to show which flags are
# being enabled during the configuration time.
-
-@@ -343,6 +347,10 @@ bmcweblib = static_library(
+
+@@ -344,6 +348,10 @@ bmcweblib = static_library(
dependencies: bmcweb_dependencies,
)
-
+
+if get_option('mtls-grpc').enabled()
+ subdir('grpc-redfish')
+endif
@@ -260,12 +260,12 @@
executable(
'bmcweb',
diff --git a/meson_options.txt b/meson_options.txt
-index 57fb8ce0..f27e41c8 100644
+index ef74cd5b..e60c5e68 100644
--- a/meson_options.txt
+++ b/meson_options.txt
-@@ -320,3 +320,46 @@ option(
- enable on production systems at this time. Other query
- parameters such as only are not controlled by this option.'''
+@@ -328,3 +328,46 @@ option(
+ description: '''Enables HealthPopulate and generate the Status property for
+ the resource'''
)
+
+# gRPC options
@@ -317,7 +317,7 @@
@@ -159,10 +159,13 @@ inline bool handleIfMatch(crow::App& app, const crow::Request& req,
std::function<void(crow::Response&)> handler =
asyncResp->res.releaseCompleteRequestHandler();
-
+
+ auto authzState = req.authzState;
+ bool fromGrpc = req.fromGrpc;
asyncResp->res.setCompleteRequestHandler(
@@ -329,7 +329,7 @@
+ fromGrpc(fromGrpc)](crow::Response& resIn) mutable {
+ processAllParams(app, query, authzState, fromGrpc, handler, resIn);
});
-
+
return needToCallHandlers;
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index 96885ebb..a603848f 100644
@@ -339,7 +339,7 @@
#pragma once
+#include "bmcweb_authorizer_singleton.h"
#include "bmcweb_config.h"
-
+
#include "app.hpp"
@@ -768,10 +769,14 @@ class MultiAsyncResp : public std::enable_shared_from_this<MultiAsyncResp>
// allows callers to attach sub-responses within the json tree that need
@@ -357,7 +357,7 @@
+ finalRes(std::move(finalResIn)), authzState(stateIn),
+ fromGrpc(fromGrpcIn)
{}
-
+
void addAwaitingResponse(
@@ -820,6 +825,8 @@ class MultiAsyncResp : public std::enable_shared_from_this<MultiAsyncResp>
messages::internalError(finalRes->res);
@@ -365,22 +365,22 @@
}
+ newReq.authzState = authzState;
+ newReq.fromGrpc = fromGrpc;
-
+
auto asyncResp = std::make_shared<bmcweb::AsyncResp>();
BMCWEB_LOG_DEBUG << "setting completion handler on "
@@ -841,6 +848,8 @@ class MultiAsyncResp : public std::enable_shared_from_this<MultiAsyncResp>
-
+
crow::App& app;
std::shared_ptr<bmcweb::AsyncResp> finalRes;
+ ::milotic::authz::BmcWebAuthorizerSingleton::RequestState authzState;
+ bool fromGrpc;
};
-
+
inline void processTopAndSkip(const Query& query, crow::Response& res)
@@ -961,10 +970,11 @@ inline void processSelect(crow::Response& intermediateResponse,
recursiveSelect(intermediateResponse.jsonValue, trieRoot);
}
-
+
-inline void
- processAllParams(crow::App& app, const Query& query,
- std::function<void(crow::Response&)>& completionHandler,
@@ -395,7 +395,7 @@
{
@@ -999,7 +1009,8 @@ inline void
std::move(intermediateResponse));
-
+
asyncResp->res.setCompleteRequestHandler(std::move(completionHandler));
- auto multi = std::make_shared<MultiAsyncResp>(app, asyncResp);
+ auto multi = std::make_shared<MultiAsyncResp>(app, asyncResp,
@@ -410,7 +410,7 @@
@@ -15,6 +15,8 @@
*/
#pragma once
-
+
+#include "bmcweb_authorizer_singleton.h"
+
#include "app.hpp"
@@ -444,16 +444,16 @@
+ .GetRedfishPrivilegeRegistry();
+ });
}
-
+
} // namespace redfish
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
index b13ab270..6fbc0212 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -22,6 +22,26 @@
-
+
#include <systemd/sd-daemon.h>
-
+
+#ifdef BMCWEB_ENABLE_GRPC
+#include "absl/flags/flag.h"
+#include "absl/flags/parse.h"
@@ -478,9 +478,9 @@
#include <google/google_service_root.hpp>
#include <sdbusplus/asio/connection.hpp>
@@ -147,16 +167,44 @@ static int run()
-
+
bmcweb::registerUserRemovedSignal();
-
+
+#ifdef BMCWEB_ENABLE_GRPC
+ absl::InitializeLog();
+ GRPCRedfishService grpc_service(app, io);
@@ -492,7 +492,7 @@
+#endif
app.run();
io->run();
-
+
+#ifdef BMCWEB_ENABLE_GRPC
+ grpc_service.shutdown();
+
@@ -503,10 +503,10 @@
+#endif
+
crow::connections::systemBus = nullptr;
-
+
return 0;
}
-
+
+#ifdef BMCWEB_ENABLE_GRPC
+int main(int argc, char** argv)
+{
@@ -522,6 +522,6 @@
try
{
return run();
---
-2.40.1.606.ga4b1b128d6-goog
+--
+2.41.0.rc0.172.g3f132b7071-goog
diff --git a/recipes-phosphor/interfaces/bmcweb/0026-Memory-implement-efficient-expand-handler.patch b/recipes-phosphor/interfaces/bmcweb/0026-Memory-implement-efficient-expand-handler.patch
index a613b22..04bdcf5 100644
--- a/recipes-phosphor/interfaces/bmcweb/0026-Memory-implement-efficient-expand-handler.patch
+++ b/recipes-phosphor/interfaces/bmcweb/0026-Memory-implement-efficient-expand-handler.patch
@@ -1,4 +1,4 @@
-From 9c31895eeca4fb6a7a41ab6b501107dbd4ebe925 Mon Sep 17 00:00:00 2001
+From c6d51985896f14c98a314bbd8b4525ff923d8261 Mon Sep 17 00:00:00 2001
From: Nan Zhou <nanzhoumails@gmail.com>
Date: Sun, 1 May 2022 01:11:07 +0000
Subject: [PATCH] Memory: implement efficient expand handler
@@ -155,11 +155,11 @@
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Iab757c9f39db04a50e981c2852b4274acab51175
---
- redfish-core/lib/memory.hpp | 434 +++++++++++++++++++++++++++++-------
- 1 file changed, 358 insertions(+), 76 deletions(-)
+ redfish-core/lib/memory.hpp | 443 +++++++++++++++++++++++++++++-------
+ 1 file changed, 363 insertions(+), 80 deletions(-)
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
-index 44784726..d1529204 100644
+index b8dc0836..431cdd67 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -18,6 +18,7 @@
@@ -170,14 +170,16 @@
#include "query.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/collection.hpp"
-@@ -32,6 +33,9 @@
-
+@@ -30,8 +31,11 @@
+ #include <sdbusplus/asio/property.hpp>
+ #include <sdbusplus/unpack_properties.hpp>
+
++#include <algorithm>
#include <array>
#include <string_view>
-+#include <algorithm>
+#include <unordered_map>
+#include <unordered_set>
-
+
namespace redfish
{
@@ -397,11 +401,6 @@ inline void
@@ -192,21 +194,23 @@
const uint16_t* memoryDataWidth = nullptr;
const size_t* memorySizeInKB = nullptr;
const std::string* partNumber = nullptr;
-@@ -599,31 +598,10 @@ inline void
+@@ -599,33 +598,10 @@ inline void
}
-
+
getPersistentMemoryProperties(aResp, properties, jsonPtr);
-}
-
+-
-inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp,
- const std::string& dimmId,
- const std::string& service,
- const std::string& objPath)
-{
+-#ifdef HEALTH_POPULATE
- auto health = std::make_shared<HealthPopulate>(aResp);
- health->selfPath = objPath;
- health->populate();
--
+-#endif
+
- BMCWEB_LOG_DEBUG << "Get available system components.";
- sdbusplus::asio::getAllProperties(
- *crow::connections::systemBus, service, objPath, "",
@@ -225,12 +229,12 @@
+ "redfish", "v1", "Systems", "system", "Memory", dimmId);
+ aResp->res.jsonValue[jsonPtr]["@odata.type"] = "#Memory.v1_11_0.Memory";
}
-
+
inline void assembleDimmPartitionData(
-@@ -679,90 +657,379 @@ inline void assembleDimmPartitionData(
+@@ -681,90 +657,381 @@ inline void assembleDimmPartitionData(
aResp->res.jsonValue[regionPtr].emplace_back(std::move(partition));
}
-
+
-inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> aResp,
- const std::string& service,
- const std::string& path)
@@ -302,7 +306,7 @@
+ std::shared_ptr<bmcweb::AsyncResp> asyncResponse;
+ std::shared_ptr<HealthPopulate> health;
+ std::unordered_map<std::string, nlohmann::json::json_pointer> dimmToPtr;
-
+
+ private:
+ void populatePartitions()
+ {
@@ -407,6 +411,7 @@
+ healthPtr = "/Status"_json_pointer;
+ healthAndPartition->dimmToPtr[thisDimmID] = ""_json_pointer;
+ }
++#ifdef HEALTH_POPULATE
+ auto dimmHealth = std::make_shared<HealthPopulate>(
+ healthAndPartition->asyncResponse, healthPtr);
+ dimmHealth->selfPath = objectPath;
@@ -423,6 +428,7 @@
+ healthAndPartition->health->children.push_back(
+ std::move(dimmHealth));
+ }
++#endif
+ healthAndPartition->asyncResponse->res
+ .jsonValue[healthAndPartition->dimmToPtr[thisDimmID]]["Id"] =
+ thisDimmID;
@@ -515,14 +521,16 @@
+ }
}
+ }
-+
+
+- );
+ auto healthAndPartition = std::make_shared<memory::HealthAndPartition>(
+ aResp, std::move(partitionServiceToObjectManagerPath));
+ healthAndPartition->getAllPartitions();
+ getAllDimms(healthAndPartition, dimmId, dimmServiceToObjectManagerPath);
-+}
-
-- );
+ }
+
+-inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp,
+- const std::string& dimmId)
+inline void getObjectManagerPathsGivenServices(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::optional<std::string>& dimmId,
@@ -542,10 +550,8 @@
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTree", "/", 0,
+ std::array<std::string, 1>{"org.freedesktop.DBus.ObjectManager"});
- }
-
--inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp,
-- const std::string& dimmId)
++}
++
+// If |dimmId| is set, will only keep the first matched dimmId.
+inline void getDimmData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::optional<std::string>& dimmId)
@@ -557,9 +563,11 @@
dbus::utility::getSubTree(
"/xyz/openbmc_project/inventory", 0, dimmInterfaces,
- [dimmId, aResp{std::move(aResp)}](
-+ [asyncResp{asyncResp}, dimmId](
- const boost::system::error_code& ec,
- const dbus::utility::MapperGetSubTreeResponse& subtree) {
+- const boost::system::error_code& ec,
+- const dbus::utility::MapperGetSubTreeResponse& subtree) {
++ [asyncResp{asyncResp},
++ dimmId](const boost::system::error_code& ec,
++ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -601,7 +609,7 @@
+ dimmServices.insert(service);
+ foundGivenDimm = true;
}
-
+
// partitions are separate as there can be multiple
- // per
- // device, i.e.
@@ -649,8 +657,8 @@
+ std::move(partitionServices));
});
}
-
-@@ -777,7 +1044,12 @@ inline void requestRoutesMemoryCollection(App& app)
+
+@@ -779,7 +1046,12 @@ inline void requestRoutesMemoryCollection(App& app)
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& systemName) {
@@ -664,8 +672,8 @@
{
return;
}
-@@ -796,9 +1068,19 @@ inline void requestRoutesMemoryCollection(App& app)
-
+@@ -798,9 +1070,20 @@ inline void requestRoutesMemoryCollection(App& app)
+
constexpr std::array<std::string_view, 1> interfaces{
"xyz.openbmc_project.Inventory.Item.Dimm"};
- collection_util::getCollectionMembers(
@@ -681,12 +689,13 @@
+ {
+ BMCWEB_LOG_DEBUG << "Use default expand handler";
+ collection_util::getCollectionMembers(
-+ asyncResp, boost::urls::url("/redfish/v1/Systems/system/Memory"),
++ asyncResp,
++ boost::urls::url("/redfish/v1/Systems/system/Memory"),
+ interfaces);
+ }
});
}
-
---
-2.40.0.348.gf938b09366-goog
+
+--
+2.41.0.rc0.172.g3f132b7071-goog
diff --git a/recipes-phosphor/interfaces/bmcweb_%.bbappend b/recipes-phosphor/interfaces/bmcweb_%.bbappend
index c50069b..fc7f95b 100644
--- a/recipes-phosphor/interfaces/bmcweb_%.bbappend
+++ b/recipes-phosphor/interfaces/bmcweb_%.bbappend
@@ -8,9 +8,11 @@
-Dredfish-cpu-log=enabled \
-Dredfish-new-powersubsystem-thermalsubsystem=enabled \
-Dgoogle-api=enabled \
+ -Dhealth-populate=disabled \
"
SRC_URI:append:gbmc = " \
+ file://0001-health-Add-option-to-disable-health-populate.patch \
file://0001-Add-RDE-Device-aggregation-support.patch \
file://0002-Add-dbus-interfaces-calls-to-RDEd.patch \
file://0001-Add-function-to-get-associated-chassis-subtree.patch \