tools: open and commit() on updateBlobId
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Id4d531e2ea2d755aa310261966254419d78dccdb
diff --git a/tools/updater.cpp b/tools/updater.cpp
index 98ef86e..87964a7 100644
--- a/tools/updater.cpp
+++ b/tools/updater.cpp
@@ -108,8 +108,7 @@
/* Poll an open verification session. Handling closing the session is not yet
* owned by this method. */
-bool pollVerificationStatus(std::uint16_t session,
- ipmiblob::BlobInterface* blob)
+bool pollStatus(std::uint16_t session, ipmiblob::BlobInterface* blob)
{
using namespace std::chrono_literals;
@@ -217,7 +216,7 @@
std::fprintf(stderr,
"Calling stat on verification session to check status\n");
- if (pollVerificationStatus(session, blob))
+ if (pollStatus(session, blob))
{
std::fprintf(stderr, "Verification returned success\n");
success = true;
@@ -255,7 +254,7 @@
std::fprintf(stderr, "Sending over the hash file.\n");
updater->sendFile(ipmi_flash::hashBlobId, signaturePath);
- /* Trigger the verification by opening the verify file. */
+ /* Trigger the verification by opening and committing the verify file. */
std::fprintf(stderr, "Opening the verification file\n");
if (updater->verifyFile(ipmi_flash::verifyBlobId))
{
@@ -264,6 +263,24 @@
else
{
std::fprintf(stderr, "failed\n");
+ throw ToolException("Verification failed");
+ }
+
+ /* Trigger the update by opening and committing the update file. */
+ std::fprintf(stderr, "Opening the update file\n");
+ if (updater->verifyFile(ipmi_flash::updateBlobId))
+ {
+ std::fprintf(stderr, "succeeded\n");
+ }
+ else
+ {
+ /* Depending on the update mechanism used, this may be uninteresting.
+ * For instance, for the static layout, we use the reboot update
+ * mechanism. Which doesn't always lead to a successful return before
+ * the BMC starts shutting down services.
+ */
+ std::fprintf(stderr, "failed\n");
+ throw ToolException("Update failed");
}
}
diff --git a/tools/updater.hpp b/tools/updater.hpp
index 4674e91..ac4b11a 100644
--- a/tools/updater.hpp
+++ b/tools/updater.hpp
@@ -59,8 +59,7 @@
* @param[in] blob - pointer to blob interface implementation object.
* @return true if the verification was successul.
*/
-bool pollVerificationStatus(std::uint16_t session,
- ipmiblob::BlobInterface* blob);
+bool pollStatus(std::uint16_t session, ipmiblob::BlobInterface* blob);
/**
* Attempt to update the BMC's firmware using the interface provided.