updater: Cleanup Active blob to support multiple stages
Without the change, the update will fail due to existing active blob.
```
./burn_my_bmc --command update --interface ipmipci \
--image test.txt --sig test.txt --type bios
Sending over the firmware image.
sendFile with /flash/bios and test.txt
Opening the cleanup blob
Committing to the cleanup blob
Closing cleanup blob
Exception received: blob exception received: Received IPMI_CC: 255
```
With the Change, it will delete the active blob to continue the update.
```
./burn_my_bmc --command update --interface ipmipci \
--image test.txt --sig test.txt --type bios
Found an active blob, deleting /flash/active/image
Opening the cleanup blob
Committing to the cleanup blob
Closing cleanup blob
Committing to the cleanup blob
Closing cleanup blob
Sending over the firmware image.
sendFile with /flash/bios and test.txt
000Find [0x1050 0x750]
bar0[0x90100000]
Progress: 100.00%
001Sending over the hash file.
sendFile with /flash/hash and test.txt
000Find [0x1050 0x750]
bar0[0x90100000]
Progress: 100.00%
001Opening the verification file
Committing to /flash/verify to trigger service
Calling stat on /flash/verify session to check status
running
running
failed
Returned non-success (could still be running (unlikely))
failed
Opening the cleanup blob
Committing to the cleanup blob
Closing cleanup blob
Exception received: Verification failed
```
Signed-off-by: Willy Tu <wltu@google.com>
Change-Id: I46a802c7faece60a9b5354db47860e796af99107
diff --git a/tools/updater.hpp b/tools/updater.hpp
index 739d3e9..bcadd31 100644
--- a/tools/updater.hpp
+++ b/tools/updater.hpp
@@ -13,14 +13,15 @@
* Attempt to update the BMC's firmware using the interface provided.
*
* @param[in] updater - update handler object.
+ * @param[in] blob - ipmi blob object.
* @param[in] imagePath - the path to the image file.
* @param[in] signaturePath - the path to the signature file.
* @param[in] layoutType - the image update layout type (static/ubi/other)
* @param[in] ignoreUpdate - determines whether to ignore the update status
* @throws ToolException on failures.
*/
-void updaterMain(UpdateHandlerInterface* updater, const std::string& imagePath,
- const std::string& signaturePath,
+void updaterMain(UpdateHandlerInterface* updater, ipmiblob::BlobInterface* blob,
+ const std::string& imagePath, const std::string& signaturePath,
const std::string& layoutType, bool ignoreUpdate);
} // namespace host_tool