fw-update: Add device completion status tracking for error cases
This commit enhances error handling by properly tracking device
completion status across all firmware update operations. This ensures
that PLDM UA state is reset after a failed update allowing the user to
trigger another update.
Tests:
- Back to back FW Updates with a corrupted package
Change-Id: I4f52662d85028116a6eaea11ae469000bc6c7ee3
Signed-off-by: P Arun Kumar Reddy <arunpapannagari23@gmail.com>
diff --git a/fw-update/device_updater.cpp b/fw-update/device_updater.cpp
index a879b23..14d507b 100644
--- a/fw-update/device_updater.cpp
+++ b/fw-update/device_updater.cpp
@@ -77,6 +77,7 @@
// Handle error scenario
error("No response received for request update for endpoint ID '{EID}'",
"EID", eid);
+ updateManager->updateDeviceCompletion(eid, false);
return;
}
@@ -98,6 +99,7 @@
error(
"Failure in request update response for endpoint ID '{EID}', completion code '{CC}'",
"EID", eid, "CC", completionCode);
+ updateManager->updateDeviceCompletion(eid, false);
return;
}
@@ -209,6 +211,7 @@
error(
"No response received for pass component table for endpoint ID '{EID}'",
"EID", eid);
+ updateManager->updateDeviceCompletion(eid, false);
return;
}
@@ -233,6 +236,7 @@
error(
"Failed to pass component table response for endpoint ID '{EID}', completion code '{CC}'",
"EID", eid, "CC", completionCode);
+ updateManager->updateDeviceCompletion(eid, false);
return;
}
// Handle ComponentResponseCode
@@ -342,6 +346,7 @@
error(
"No response received for update component with endpoint ID {EID}",
"EID", eid);
+ updateManager->updateDeviceCompletion(eid, false);
return;
}
@@ -368,6 +373,7 @@
"Failed to update request response for endpoint ID '{EID}', completion code '{CC}'",
"EID", eid, "CC", completionCode);
return;
+ updateManager->updateDeviceCompletion(eid, false);
}
}
@@ -504,6 +510,7 @@
"Failure in transfer of the component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' with transfer result - {RESULT}",
"EID", eid, "COMPONENT_VERSION", compVersion, "RESULT",
transferResult);
+ updateManager->updateDeviceCompletion(eid, false);
componentUpdateStatus[componentIndex] = false;
sendCancelUpdateComponentRequest();
}
@@ -564,6 +571,7 @@
"Failed to verify component endpoint ID '{EID}' and version '{COMPONENT_VERSION}' with transfer result - '{RESULT}'",
"EID", eid, "COMPONENT_VERSION", compVersion, "RESULT",
verifyResult);
+ updateManager->updateDeviceCompletion(eid, false);
componentUpdateStatus[componentIndex] = false;
sendCancelUpdateComponentRequest();
}
@@ -645,6 +653,7 @@
error(
"Failed to apply component endpoint ID '{EID}' and version '{COMPONENT_VERSION}', error - {ERROR}",
"EID", eid, "COMPONENT_VERSION", compVersion, "ERROR", applyResult);
+ updateManager->updateDeviceCompletion(eid, false);
componentUpdateStatus[componentIndex] = false;
sendCancelUpdateComponentRequest();
}
@@ -703,6 +712,7 @@
error(
"No response received for activate firmware for endpoint ID '{EID}'",
"EID", eid);
+ updateManager->updateDeviceCompletion(eid, false);
return;
}
@@ -725,6 +735,7 @@
error(
"Failed to activate firmware response for endpoint ID '{EID}', completion code '{CC}'",
"EID", eid, "CC", completionCode);
+ updateManager->updateDeviceCompletion(eid, false);
return;
}