Fix for incorrect Task Progress and State values
While performing the firmware updates, task will be created for tracking
the background update progress and state. There are error associated
with that code currently.
Errors on TaskId's:
- Internal errors
"Messages": [
....
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The request failed due to an internal service error. The service is still operational.",
....
}
]
- Always task is in RUNNING state.
"PercentComplete": 0,
"TaskState": "Running",
Issue details:
- Percentage: The "Progress" property in D-Bus interface
"xyz.openbmc_project.Software.ActivationProgress" is of type
"uint8_t" but bmcweb is reading type as string and that is leading to
failure and invalid values.
- TaskState: TaskState is read from d-bus after recieving associated
signal but that is not updated properly and that caused the failure.
this commit corrects the same.
Tested:
After fix, task which is created for firmware update is showing correct
"PercentageComplete" and 'TaskState".
"PercentComplete": 100,
"TaskState": "Completed",
Signed-off-by: Gayathri Leburu <gayathri.leburu@intel.com>
Signed-off-by: moni kumar <monix.kumar@intel.com>
Signed-off-by: AppaRao Puli <apparao.puli@intel.com>
Change-Id: I0354cdecc9d9ddd47b017591402fd7b3149d12ca
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 72907ba..224d48e 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -137,15 +137,14 @@
if (iface == "xyz.openbmc_project.Software.Activation")
{
- std::string* state = nullptr;
+ const std::string* state = nullptr;
for (const auto& property : values)
{
if (property.first == "Activation")
{
- const std::string* activationState =
- std::get_if<std::string>(
- &property.second);
- if (activationState == nullptr)
+ state = std::get_if<std::string>(
+ &property.second);
+ if (state == nullptr)
{
taskData->messages.emplace_back(
messages::internalError());
@@ -202,10 +201,9 @@
{
if (property.first == "Progress")
{
- const std::string* progressStr =
- std::get_if<std::string>(
- &property.second);
- if (progressStr == nullptr)
+ progress =
+ std::get_if<uint8_t>(&property.second);
+ if (progress == nullptr)
{
taskData->messages.emplace_back(
messages::internalError());
@@ -218,11 +216,10 @@
{
return !task::completed;
}
- taskData->percentComplete =
- static_cast<int>(*progress);
+ taskData->percentComplete = *progress;
taskData->messages.emplace_back(
- messages::taskProgressChanged(
- index, static_cast<size_t>(*progress)));
+ messages::taskProgressChanged(index,
+ *progress));
// if we're getting status updates it's
// still alive, update timer