summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRython Cai <rython_cai@jabil.com>2026-08-19 08:48:27 +0300
committerRython Cai <rython_cai@jabil.com>2026-08-25 08:35:56 +0300
commitab29c5fa3e1238ce5e4eff5eaf708ce73d16b9ff (patch)
tree777e53fdb25cc803d49d744a71abd4a005fbb1ce
parent6506e4283fde87fbb1a94d63eeba2a7bf5914bb4 (diff)
downloadbmcweb-ab29c5fa3e1238ce5e4eff5eaf708ce73d16b9ff.tar.xz
virtual_media: use configured manager URI name
The VirtualMedia handlers compared the manager path segment against a hardcoded "bmc" instead of BMCWEB_REDFISH_MANAGER_URI_NAME. That constant comes from the redfish-manager-uri-name meson option, which defaults to "bmc" but may be set to any value. When the option is set to another value, Manager still advertises VirtualMedia at /redfish/v1/Managers/<name>/VirtualMedia, but the VirtualMedia handlers rejected that URI with resourceNotFound. The collection GET, the resource GET, and the InsertMedia and EjectMedia actions were all unreachable, so Manager published a dangling link. Compare against BMCWEB_REDFISH_MANAGER_URI_NAME instead, matching how managers.hpp, network_protocol.hpp, and update_service.hpp already validate the manager segment. Behavior is unchanged for the default option value. Tested: Built bmcweb with -Dredfish-manager-uri-name=manager. Verified GET /redfish/v1/Managers/manager/VirtualMedia works. Verified the default manager URI behavior remains unchanged. Change-Id: I2375398d6a2780ef403870061d6583b3ae699551 Signed-off-by: Rython Cai <rython_cai@jabil.com>
-rw-r--r--redfish-core/lib/virtual_media.hpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 236c119c6d..79257ea091 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -3,6 +3,8 @@
// SPDX-FileCopyrightText: Copyright 2018 Intel Corporation
#pragma once
+#include "bmcweb_config.h"
+
#include "app.hpp"
#include "async_resp.hpp"
#include "credential_pipe.hpp"
@@ -715,7 +717,7 @@ inline void handleManagersVirtualMediaActionInsertPost(
}
constexpr std::string_view action = "VirtualMedia.InsertMedia";
- if (name != "bmc")
+ if (name != BMCWEB_REDFISH_MANAGER_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, action, resName);
@@ -802,7 +804,7 @@ inline void handleManagersVirtualMediaActionEject(
}
constexpr std::string_view action = "VirtualMedia.EjectMedia";
- if (managerName != "bmc")
+ if (managerName != BMCWEB_REDFISH_MANAGER_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, action, resName);
@@ -868,7 +870,7 @@ inline void handleManagersVirtualMediaCollectionGet(
{
return;
}
- if (name != "bmc")
+ if (name != BMCWEB_REDFISH_MANAGER_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "VirtualMedia", name);
@@ -909,7 +911,7 @@ inline void handleVirtualMediaGet(
{
return;
}
- if (name != "bmc")
+ if (name != BMCWEB_REDFISH_MANAGER_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "VirtualMedia", resName);