diff options
| author | Patrick Venture <venture@google.com> | 2019-06-05 13:42:28 -0700 |
|---|---|---|
| committer | Patrick Venture <venture@google.com> | 2019-06-05 13:42:28 -0700 |
| commit | 14713becef822c418cac3ee6a3c4d6e4d4ae40d8 (patch) | |
| tree | d55b5ddf6e2ac17a61b4000441aebf8b876a584a /tools | |
| parent | d816b23b955a7b575fba0a08540eb46ee02919af (diff) | |
| download | phosphor-ipmi-flash-14713becef822c418cac3ee6a3c4d6e4d4ae40d8.tar.gz phosphor-ipmi-flash-14713becef822c418cac3ee6a3c4d6e4d4ae40d8.zip | |
tools: open and commit() on updateBlobId
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Id4d531e2ea2d755aa310261966254419d78dccdb
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/updater.cpp | 25 | ||||
| -rw-r--r-- | tools/updater.hpp | 3 |
2 files changed, 22 insertions, 6 deletions
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 @@ void UpdateHandler::sendFile(const std::string& target, const std::string& path) /* 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 @@ bool UpdateHandler::verifyFile(const std::string& target) 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 @@ void updaterMain(UpdateHandler* updater, const std::string& imagePath, 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 @@ void updaterMain(UpdateHandler* updater, const std::string& imagePath, 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 @@ class UpdateHandler * @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. |

