Add an option flag for multi-computersystem
A number of discussions have occurred, and it's clear that
multi-computer system is not a transition that can be done in a single
series of commits, and needs to be done incrementally over time. This
commit adds the initial option for multi-computer system support, with
an option flag that can be enabled when the new behavior is desired.
This is to prevent needing a long-lived fork.
This option operatates such that if enabled, all ComputerSystem route
options will now return 404. This is to allow the redfish service
validator to pass, and to be used for incremental development. As the
routes are moved over, they will be enabled, and service validator
re-run.
Per the description in the meson options, this option flag, and all code
beneath of it will be removed on 9/1/23. The expectation is that by
this date, given the appropriate level of effort in implementation,
there will be no code remaining under that option flag. After this
date, code beneath this option flag will be removed.
Tested: No functional changes without option.
With option enabled, /redfish/v1/Systems produces no entries.
Spot check of various routes returns 404.
Redfish service validator passes.
Change-Id: I3b58642cb76d61df668076c2e0f1e7bed110ae25
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index 1153516..b358b5f 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -19,6 +19,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -63,6 +70,14 @@
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp
index 2b4b4ae..d3119d3 100644
--- a/redfish-core/lib/fabric_adapters.hpp
+++ b/redfish-core/lib/fabric_adapters.hpp
@@ -255,6 +255,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
getValidFabricAdapterPath(
adapterId, systemName, asyncResp,
@@ -274,6 +281,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -307,6 +321,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -329,6 +350,13 @@
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
getValidFabricAdapterPath(adapterId, systemName, asyncResp,
[asyncResp, systemName, adapterId](
const std::string&, const std::string&) {
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index fedf7ad..7ad489b 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -1088,6 +1088,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1359,6 +1366,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1457,6 +1471,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
@@ -1527,6 +1548,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1719,6 +1747,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1826,6 +1861,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1869,6 +1911,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1934,6 +1983,13 @@
asyncResp->res.result(boost::beast::http::status::bad_request);
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2103,6 +2159,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2140,6 +2203,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2217,6 +2287,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2815,15 +2892,24 @@
inline void handleLogServicesDumpCollectDiagnosticDataComputerSystemPost(
crow::App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& chassisId)
+ const std::string& systemName)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
- if (chassisId != "system")
+
+ if constexpr (bmcwebEnableMultiHost)
{
- messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
return;
}
createDump(asyncResp, req, "System");
@@ -2843,15 +2929,23 @@
inline void handleLogServicesDumpClearLogComputerSystemPost(
crow::App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& chassisId)
+ const std::string& systemName)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
- if (chassisId != "system")
+ if constexpr (bmcwebEnableMultiHost)
{
- messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
return;
}
clearDump(asyncResp, "System");
@@ -3023,6 +3117,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3074,6 +3175,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3184,6 +3292,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3253,6 +3368,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3280,6 +3402,13 @@
// Do not call getRedfishRoute here since the crashdump file is not a
// Redfish resource.
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3382,6 +3511,13 @@
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3511,6 +3647,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3558,6 +3701,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3603,6 +3753,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3945,6 +4102,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
@@ -3989,6 +4153,13 @@
asyncResp->res.result(boost::beast::http::status::bad_request);
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -4068,6 +4239,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index b630609..a3f060b 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -2006,17 +2006,19 @@
asyncResp->res.jsonValue["GraphicalConsole"]["ConnectTypesSupported"] =
nlohmann::json::array_t({"KVMIP"});
#endif // BMCWEB_ENABLE_KVM
+ if constexpr (!bmcwebEnableMultiHost)
+ {
+ asyncResp->res.jsonValue["Links"]["ManagerForServers@odata.count"] =
+ 1;
- asyncResp->res.jsonValue["Links"]["ManagerForServers@odata.count"] = 1;
+ nlohmann::json::array_t managerForServers;
+ nlohmann::json::object_t manager;
+ manager["@odata.id"] = "/redfish/v1/Systems/system";
+ managerForServers.emplace_back(std::move(manager));
- nlohmann::json::array_t managerForServers;
- nlohmann::json::object_t manager;
- manager["@odata.id"] = "/redfish/v1/Systems/system";
- managerForServers.emplace_back(std::move(manager));
-
- asyncResp->res.jsonValue["Links"]["ManagerForServers"] =
- std::move(managerForServers);
-
+ asyncResp->res.jsonValue["Links"]["ManagerForServers"] =
+ std::move(managerForServers);
+ }
if constexpr (bmcwebEnableHealthPopulate)
{
auto health = std::make_shared<HealthPopulate>(asyncResp);
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index c85ff26..6c970db 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -787,6 +787,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -823,6 +830,15 @@
{
return;
}
+
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index a89fe1d..d623321 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -106,6 +106,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -363,6 +370,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -436,12 +450,19 @@
inline void handlePCIeFunctionCollectionGet(
App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& pcieDeviceId)
+ const std::string& systemName, const std::string& pcieDeviceId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
getValidPCIeDevicePath(
pcieDeviceId, asyncResp,
@@ -474,7 +495,7 @@
* Functions triggers appropriate requests on DBus
*/
BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions/")
+ "/redfish/v1/Systems/<str>/PCIeDevices/<str>/PCIeFunctions/")
.privileges(redfish::privileges::getPCIeFunctionCollection)
.methods(boost::beast::http::verb::get)(
std::bind_front(handlePCIeFunctionCollectionGet, std::ref(app)));
@@ -574,6 +595,7 @@
inline void
handlePCIeFunctionGet(App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName,
const std::string& pcieDeviceId,
const std::string& pcieFunctionIdStr)
{
@@ -581,6 +603,20 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
uint64_t pcieFunctionId = 0;
std::from_chars_result result = std::from_chars(
&*pcieFunctionIdStr.begin(), &*pcieFunctionIdStr.end(), pcieFunctionId);
@@ -610,8 +646,7 @@
inline void requestRoutesSystemPCIeFunction(App& app)
{
BMCWEB_ROUTE(
- app,
- "/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions/<str>/")
+ app, "/redfish/v1/Systems/<str>/PCIeDevices/<str>/PCIeFunctions/<str>/")
.privileges(redfish::privileges::getPCIeFunction)
.methods(boost::beast::http::verb::get)(
std::bind_front(handlePCIeFunctionGet, std::ref(app)));
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 2d52cd7..1806ffc 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -1163,17 +1163,32 @@
inline void requestRoutesOperatingConfigCollection(App& app)
{
- BMCWEB_ROUTE(
- app, "/redfish/v1/Systems/system/Processors/<str>/OperatingConfigs/")
+ BMCWEB_ROUTE(app,
+ "/redfish/v1/Systems/<str>/Processors/<str>/OperatingConfigs/")
.privileges(redfish::privileges::getOperatingConfigCollection)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& cpuName) {
+ const std::string& systemName, const std::string& cpuName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
asyncResp->res.jsonValue["@odata.type"] =
"#OperatingConfigCollection.OperatingConfigCollection";
asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
@@ -1230,16 +1245,31 @@
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/Processors/<str>/OperatingConfigs/<str>/")
+ "/redfish/v1/Systems/<str>/Processors/<str>/OperatingConfigs/<str>/")
.privileges(redfish::privileges::getOperatingConfig)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& cpuName, const std::string& configName) {
+ const std::string& systemName, const std::string& cpuName,
+ const std::string& configName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
// Ask for all objects implementing OperatingConfig so we can search
// for one with a matching name
constexpr std::array<std::string_view, 1> interfaces = {
@@ -1306,6 +1336,14 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1353,6 +1391,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1384,6 +1429,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index fce53f4..6b60ae7 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -96,7 +96,6 @@
.privileges(redfish::privileges::getStorageCollection)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleSystemsStorageCollectionGet, std::ref(app)));
-
BMCWEB_ROUTE(app, "/redfish/v1/Storage/")
.privileges(redfish::privileges::getStorageCollection)
.methods(boost::beast::http::verb::get)(
@@ -202,12 +201,20 @@
inline void
handleSystemsStorageGet(App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName,
const std::string& storageId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.Inventory.Item.Storage"};
@@ -280,7 +287,7 @@
inline void requestRoutesStorage(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Storage/<str>/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Storage/<str>/")
.privileges(redfish::privileges::getStorage)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleSystemsStorageGet, std::ref(app)));
@@ -705,6 +712,14 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 86730a5..26905bf 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -2833,28 +2833,46 @@
asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems";
asyncResp->res.jsonValue["Name"] = "Computer System Collection";
+ nlohmann::json& ifaceArray = asyncResp->res.jsonValue["Members"];
+ ifaceArray = nlohmann::json::array();
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ asyncResp->res.jsonValue["Members@odata.count"] = 0;
+ // Option currently returns no systems. TBD
+ return;
+ }
+ asyncResp->res.jsonValue["Members@odata.count"] = 1;
+ nlohmann::json::object_t system;
+ system["@odata.id"] = "/redfish/v1/Systems/system";
+ ifaceArray.emplace_back(std::move(system));
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
"/xyz/openbmc_project/network/hypervisor",
"xyz.openbmc_project.Network.SystemConfiguration", "HostName",
[asyncResp](const boost::system::error_code& ec2,
const std::string& /*hostName*/) {
- nlohmann::json& ifaceArray = asyncResp->res.jsonValue["Members"];
- ifaceArray = nlohmann::json::array();
- auto& count = asyncResp->res.jsonValue["Members@odata.count"];
-
- nlohmann::json::object_t system;
- system["@odata.id"] = "/redfish/v1/Systems/system";
- ifaceArray.emplace_back(std::move(system));
- count = ifaceArray.size();
- if (!ec2)
+ if (ec2)
{
- BMCWEB_LOG_DEBUG << "Hypervisor is available";
- nlohmann::json::object_t hypervisor;
- hypervisor["@odata.id"] = "/redfish/v1/Systems/hypervisor";
- ifaceArray.emplace_back(std::move(hypervisor));
- count = ifaceArray.size();
+ return;
}
+ auto val = asyncResp->res.jsonValue.find("Members@odata.count");
+ if (val == asyncResp->res.jsonValue.end())
+ {
+ BMCWEB_LOG_CRITICAL << "Count wasn't found??";
+ return;
+ }
+ uint64_t* count = val->get_ptr<uint64_t*>();
+ if (count == nullptr)
+ {
+ BMCWEB_LOG_CRITICAL << "Count wasn't found??";
+ return;
+ }
+ *count = *count + 1;
+ BMCWEB_LOG_DEBUG << "Hypervisor is available";
+ nlohmann::json& ifaceArray2 = asyncResp->res.jsonValue["Members"];
+ nlohmann::json::object_t hypervisor;
+ hypervisor["@odata.id"] = "/redfish/v1/Systems/hypervisor";
+ ifaceArray2.emplace_back(std::move(hypervisor));
});
});
}
@@ -2933,16 +2951,29 @@
* Function handles POST method request.
* Analyzes POST body message before sends Reset request data to D-Bus.
*/
- BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Actions/ComputerSystem.Reset/")
.privileges(redfish::privileges::postComputerSystem)
.methods(boost::beast::http::verb::post)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemId);
+ return;
+ }
+ if (systemId != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemId);
+ return;
+ }
std::string resetType;
if (!json_util::readJsonAction(req, asyncResp->res, "ResetType",
resetType))
@@ -3041,7 +3072,8 @@
inline void handleComputerSystemCollectionHead(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& /*systemName*/)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
@@ -3094,7 +3126,7 @@
*/
inline void requestRoutesSystems(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/")
.privileges(redfish::privileges::headComputerSystem)
.methods(boost::beast::http::verb::head)(
std::bind_front(handleComputerSystemCollectionHead, std::ref(app)));
@@ -3112,6 +3144,14 @@
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
if (systemName == "hypervisor")
{
handleHypervisorSystemGet(asyncResp);
@@ -3261,6 +3301,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3386,7 +3433,8 @@
inline void handleSystemCollectionResetActionHead(
crow::App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& /*systemId*/)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
@@ -3403,7 +3451,7 @@
*/
inline void requestRoutesSystemResetActionInfo(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/ResetActionInfo/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/ResetActionInfo/")
.privileges(redfish::privileges::headActionInfo)
.methods(boost::beast::http::verb::head)(std::bind_front(
handleSystemCollectionResetActionHead, std::ref(app)));
@@ -3420,6 +3468,13 @@
{
return;
}
+ if constexpr (bmcwebEnableMultiHost)
+ {
+ // Option currently returns no systems. TBD
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
if (systemName == "hypervisor")
{