update service name for UPDATESERVICE_USE_DBUS
Update the Dbus service name and path for
BMCWEB_REDFISH_UPDATESERVICE_USE_DBUS. As part of updated implementation
the new BMC code updater daemon name is
xyz.openbmc_project.Software.Manager, update setActiveImage and
FactoryReset flows to reflect so.
Tested:
```
> curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X POST https://${bmc}/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults -d '{"ResetType": "ResetAll"}'
{
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The request completed successfully.",
"MessageArgs": [],
"MessageId": "Base.1.19.0.Success",
"MessageSeverity": "OK",
"Resolution": "None."
}
]
}
> curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH https://${bmc}/redfish/v1/Managers/bmc -d '{"Links": {"ActiveSoftwareImage": {"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/70f4c0cb"}}}'
{
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The request completed successfully.",
"MessageArgs": [],
"MessageId": "Base.1.19.0.Success",
"MessageSeverity": "OK",
"Resolution": "None."
}
]
}
```
Change-Id: I42ef2485fa119474b7fd12ea94dd654c3432c067
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index e20624e..226e33d 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -50,6 +50,24 @@
namespace redfish
{
+inline std::string getBMCUpdateServiceName()
+{
+ if constexpr (BMCWEB_REDFISH_UPDATESERVICE_USE_DBUS)
+ {
+ return "xyz.openbmc_project.Software.Manager";
+ }
+ return "xyz.openbmc_project.Software.BMC.Updater";
+}
+
+inline std::string getBMCUpdateServicePath()
+{
+ if constexpr (BMCWEB_REDFISH_UPDATESERVICE_USE_DBUS)
+ {
+ return "/xyz/openbmc_project/software/bmc";
+ }
+ return "/xyz/openbmc_project/software";
+}
+
/**
* Function reboots the BMC.
*
@@ -255,8 +273,7 @@
// Can't erase what the BMC is running on
doBMCGracefulRestart(asyncResp);
},
- "xyz.openbmc_project.Software.BMC.Updater",
- "/xyz/openbmc_project/software",
+ getBMCUpdateServiceName(), getBMCUpdateServicePath(),
"xyz.openbmc_project.Common.FactoryReset", "Reset");
});
}
@@ -1840,7 +1857,7 @@
// Make sure the image is valid before setting priority
sdbusplus::message::object_path objPath("/xyz/openbmc_project/software");
dbus::utility::getManagedObjects(
- "xyz.openbmc_project.Software.BMC.Updater", objPath,
+ getBMCUpdateServiceName(), objPath,
[asyncResp, firmwareId, runningFirmwareTarget](
const boost::system::error_code& ec,
const dbus::utility::ManagedObjectType& subtree) {
@@ -1898,8 +1915,7 @@
// An addition could be a Redfish Setting like
// ActiveSoftwareImageApplyTime and support OnReset
sdbusplus::asio::setProperty(
- *crow::connections::systemBus,
- "xyz.openbmc_project.Software.BMC.Updater",
+ *crow::connections::systemBus, getBMCUpdateServiceName(),
"/xyz/openbmc_project/software/" + firmwareId,
"xyz.openbmc_project.Software.RedundancyPriority", "Priority",
static_cast<uint8_t>(0),