Fix 404 on Hypervisor Reset
/redfish/v1/Systems/hypervisor/Actions/ComputerSystem.Reset was
returning a 404. On closer inspection, it was due to hitting the System
.Reset Action and not making it to the Hypervisor specific action. [1].
Remove the Hypervisor specific action and call the method from the
System .Reset Action. This is how we do the handleHypervisorSystemGet
already.
Believe this was broke by 7f3e84a151. [2] It is only now being
discovered due to a recent rebase with upstream.
Follow the commit before and put this behind the new Hypervisor Computer
System Option.
[1]: https://github.com/openbmc/bmcweb/blob/cd504a94c827fbc98908b2a712f49ea0adf7aab8/redfish-core/lib/systems.hpp#L3493
[2]: https://github.com/openbmc/bmcweb/commit/7f3e84a151e106d9227d08358e9ee3fd225b34c4
Tested: On Patchset 2,
/redfish/v1/Systems/hypervisor/Actions/ComputerSystem.Reset returns a
204.
Change-Id: I3599bb8419604d71684ce61ca992f4b87c1d3fa5
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp
index 1660e3b..ebe9ea6 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -891,13 +891,9 @@
}
inline void handleHypervisorSystemResetPost(
- App& app, const crow::Request& req,
+ const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- if (!redfish::setUpRedfishRoute(app, req, asyncResp))
- {
- return;
- }
std::optional<std::string> resetType;
if (!json_util::readJsonAction(req, asyncResp->res, "ResetType", resetType))
{
@@ -953,11 +949,5 @@
.privileges(redfish::privileges::patchEthernetInterface)
.methods(boost::beast::http::verb::patch)(std::bind_front(
handleHypervisorEthernetInterfacePatch, std::ref(app)));
-
- BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/hypervisor/Actions/ComputerSystem.Reset/")
- .privileges(redfish::privileges::postComputerSystem)
- .methods(boost::beast::http::verb::post)(
- std::bind_front(handleHypervisorSystemResetPost, std::ref(app)));
}
} // namespace redfish
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index f90bb83..4ad92dd 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -2872,6 +2872,16 @@
{
return;
}
+
+ if constexpr (BMCWEB_HYPERVISOR_COMPUTER_SYSTEM)
+ {
+ if (systemName == "hypervisor")
+ {
+ handleHypervisorSystemResetPost(req, asyncResp);
+ return;
+ }
+ }
+
if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",