Fix hypervisor system Get
The reason for this change is that there are two routes defined:
[1] /redfish/v1/Systems/<str> in systems.hpp
[2] /redfish/v1/Systems/hypervisor in hypervisor_system.hpp
Whenever a user does a get on /redfish/v1/Systems/hypervisor, the first
route is hit and that checks if <str> is "system" and if not, bmcweb
returns resource not found error.
```
Error:
ERROR - Members: GET of resource at URI /redfish/v1/Systems/hypervisor returned HTTP error. Check URI.
ERROR - URI did not return resource /redfish/v1/Systems/hypervisor
GET Failure HTTP Code (404)
```
The below upstream commit is causing this issue:
[1] openbmc/bmcweb@22d268c#diff-cddfc26fddb6ba29f3fd81ecf5840fc6d9a8554bbca92f578d81b97db8b14895
To resolve this issue, an if hypervisor is inserted in the
/redfish/v1/Systems/<str> and that calls handleHypervisorSystemGet. The
/redfish/v1/Systems/hypervisor in redfish-core/lib/hypervisor_system.hpp
is removed.
Also fix /redfish/v1/Systems/hypervisor/ResetActionInfo/.
Redfish validator passed.
redfish/v1/Systems/hypervisor looks good.
/redfish/v1/Systems/hypervisor/ResetActionInfo/ looks good.
Change-Id: Ie2d9d19c258236ce86d6552ae4a3bd486e02de01
Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
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 80e1724..35f33af 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -804,13 +804,8 @@
}
inline void handleHypervisorSystemGet(
- App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- if (!redfish::setUpRedfishRoute(app, req, asyncResp))
- {
- return;
- }
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
"/xyz/openbmc_project/network/hypervisor",
@@ -958,13 +953,8 @@
}
inline void handleHypervisorResetActionGet(
- App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
- if (!redfish::setUpRedfishRoute(app, req, asyncResp))
- {
- return;
- }
// Only return action info if hypervisor D-Bus object present
constexpr std::array<std::string_view, 1> interfaces = {
"xyz.openbmc_project.State.Host"};
@@ -1085,15 +1075,6 @@
inline void requestRoutesHypervisorSystems(App& app)
{
/**
- * Hypervisor Systems derived class for delivering Computer Systems Schema.
- */
-
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/hypervisor/")
- .privileges(redfish::privileges::getComputerSystem)
- .methods(boost::beast::http::verb::get)(
- std::bind_front(handleHypervisorSystemGet, std::ref(app)));
-
- /**
* HypervisorInterfaceCollection class to handle the GET and PATCH on
* Hypervisor Interface
*/
@@ -1115,11 +1096,6 @@
.methods(boost::beast::http::verb::patch)(std::bind_front(
handleHypervisorEthernetInterfacePatch, std::ref(app)));
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/hypervisor/ResetActionInfo/")
- .privileges(redfish::privileges::getActionInfo)
- .methods(boost::beast::http::verb::get)(
- std::bind_front(handleHypervisorResetActionGet, std::ref(app)));
-
BMCWEB_ROUTE(app,
"/redfish/v1/Systems/hypervisor/Actions/ComputerSystem.Reset/")
.privileges(redfish::privileges::postComputerSystem)
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 6174610..a38cc3a 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -19,6 +19,7 @@
#include "dbus_singleton.hpp"
#include "dbus_utility.hpp"
#include "health.hpp"
+#include "hypervisor_system.hpp"
#include "led.hpp"
#include "pcie.hpp"
#include "query.hpp"
@@ -2942,6 +2943,13 @@
{
return;
}
+
+ if (systemName == "hypervisor")
+ {
+ handleHypervisorSystemGet(asyncResp);
+ return;
+ }
+
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3231,6 +3239,13 @@
{
return;
}
+
+ if (systemName == "hypervisor")
+ {
+ handleHypervisorResetActionGet(asyncResp);
+ return;
+ }
+
if (systemName != "system")
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",