Skip to content

Commit b82b62e

Browse files
committed
Multi-host support for LogServiceCollection
As a first step to introduce multi-host support for LogServices, update the LogServiceCollection accordingly to allow for request handling when redfish-experimental-multi-computer-system is enabled. Disallow all LogServices not supported for multi-host via meson. Tested: Validator succeeded. Change-Id: I619a96bcab6a0c240d93c3c6586d813ccfb43cad Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
1 parent b8bf767 commit b82b62e

File tree

2 files changed

+35
-23
lines changed

2 files changed

+35
-23
lines changed

config/meson.build

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,25 @@ else
186186
work_dir = '/home/root'
187187
endif
188188

189+
multi_comp = get_option('experimental-redfish-multi-computer-system')
190+
if multi_comp.enabled()
191+
if get_option('redfish-cpu-log').enabled()
192+
error(
193+
'redfish-cpu-log option not supported with experimental-redfish-multi-computer-system option enabled',
194+
)
195+
endif
196+
if get_option('redfish-dump-log').enabled()
197+
error(
198+
'redfish-dump-log option not supported with experimental-redfish-multi-computer-system option enabled',
199+
)
200+
endif
201+
if get_option('redfish-host-logger').enabled()
202+
error(
203+
'redfish-host-logger option not supported with experimental-redfish-multi-computer-system option enabled',
204+
)
205+
endif
206+
endif
207+
189208
configure_file(
190209
input: 'bmcweb.service.in',
191210
output: 'bmcweb.service',

redfish-core/lib/log_services.hpp

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -907,26 +907,22 @@ inline void handleSystemsLogServiceCollectionGet(
907907
{
908908
return;
909909
}
910-
if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
910+
if constexpr (!BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
911911
{
912-
// Option currently returns no systems. TBD
913-
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
914-
systemName);
915-
return;
916-
}
917-
if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
918-
{
919-
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
920-
systemName);
921-
return;
912+
if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
913+
{
914+
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
915+
systemName);
916+
return;
917+
}
922918
}
923919

924920
// Collections don't include the static data added by SubRoute
925921
// because it has a duplicate entry for members
926922
asyncResp->res.jsonValue["@odata.type"] =
927923
"#LogServiceCollection.LogServiceCollection";
928-
asyncResp->res.jsonValue["@odata.id"] = std::format(
929-
"/redfish/v1/Systems/{}/LogServices", BMCWEB_REDFISH_SYSTEM_URI_NAME);
924+
asyncResp->res.jsonValue["@odata.id"] =
925+
std::format("/redfish/v1/Systems/{}/LogServices", systemName);
930926
asyncResp->res.jsonValue["Name"] = "System Log Services Collection";
931927
asyncResp->res.jsonValue["Description"] =
932928
"Collection of LogServices for this Computer System";
@@ -947,26 +943,23 @@ inline void handleSystemsLogServiceCollectionGet(
947943
{
948944
nlohmann::json::object_t dumpLog;
949945
dumpLog["@odata.id"] =
950-
std::format("/redfish/v1/Systems/{}/LogServices/Dump",
951-
BMCWEB_REDFISH_SYSTEM_URI_NAME);
946+
std::format("/redfish/v1/Systems/{}/LogServices/Dump", systemName);
952947
logServiceArray.emplace_back(std::move(dumpLog));
953948
}
954949

955950
if constexpr (BMCWEB_REDFISH_CPU_LOG)
956951
{
957952
nlohmann::json::object_t crashdump;
958-
crashdump["@odata.id"] =
959-
std::format("/redfish/v1/Systems/{}/LogServices/Crashdump",
960-
BMCWEB_REDFISH_SYSTEM_URI_NAME);
953+
crashdump["@odata.id"] = std::format(
954+
"/redfish/v1/Systems/{}/LogServices/Crashdump", systemName);
961955
logServiceArray.emplace_back(std::move(crashdump));
962956
}
963957

964958
if constexpr (BMCWEB_REDFISH_HOST_LOGGER)
965959
{
966960
nlohmann::json::object_t hostlogger;
967-
hostlogger["@odata.id"] =
968-
std::format("/redfish/v1/Systems/{}/LogServices/HostLogger",
969-
BMCWEB_REDFISH_SYSTEM_URI_NAME);
961+
hostlogger["@odata.id"] = std::format(
962+
"/redfish/v1/Systems/{}/LogServices/HostLogger", systemName);
970963
logServiceArray.emplace_back(std::move(hostlogger));
971964
}
972965
asyncResp->res.jsonValue["Members@odata.count"] = logServiceArray.size();
@@ -975,7 +968,7 @@ inline void handleSystemsLogServiceCollectionGet(
975968
"xyz.openbmc_project.State.Boot.PostCode"};
976969
dbus::utility::getSubTreePaths(
977970
"/", 0, interfaces,
978-
[asyncResp](
971+
[asyncResp, systemName](
979972
const boost::system::error_code& ec,
980973
const dbus::utility::MapperGetSubTreePathsResponse& subtreePath) {
981974
if (ec)
@@ -993,7 +986,7 @@ inline void handleSystemsLogServiceCollectionGet(
993986
nlohmann::json::object_t member;
994987
member["@odata.id"] = std::format(
995988
"/redfish/v1/Systems/{}/LogServices/PostCodes",
996-
BMCWEB_REDFISH_SYSTEM_URI_NAME);
989+
systemName);
997990

998991
logServiceArrayLocal.emplace_back(std::move(member));
999992

0 commit comments

Comments
 (0)