summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2019-05-15 12:32:33 -0700
committerPatrick Venture <venture@google.com>2019-05-15 12:52:57 -0700
commit7dcca5dd22ca9fccd580876540baad81bc270414 (patch)
tree102350ba9e2747b5c216b0a820da85a196154376 /tools
parent88bc26edc98461494879ef0f53d45cae8a413006 (diff)
downloadphosphor-ipmi-flash-7dcca5dd22ca9fccd580876540baad81bc270414.tar.gz
phosphor-ipmi-flash-7dcca5dd22ca9fccd580876540baad81bc270414.zip
tools: trigger verification
Trigger verification via committing to the verify blob id. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: Ia3722ff144ba268cd554bac0fda06f0c426edd88
Diffstat (limited to 'tools')
-rw-r--r--tools/updater.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/tools/updater.cpp b/tools/updater.cpp
index 2465945..fd72136 100644
--- a/tools/updater.cpp
+++ b/tools/updater.cpp
@@ -33,9 +33,14 @@ void updaterMain(ipmiblob::BlobInterface* blob, DataInterface* handler,
{
/* TODO(venture): Add optional parameter to specify the flash type, default
* to legacy for now.
+ *
+ * TODO(venture): Move the strings from the FirmwareHandler object to a
+ * boring utils object so it will be more happly linked cleanly to both the
+ * BMC and host-side.
*/
std::string goalFirmware = "/flash/image";
std::string hashFilename = "/flash/hash";
+ std::string verifyFilename = "/flash/verify";
/* Get list of blob_ids, check for /flash/image, or /flash/tarball.
* TODO(venture) the mechanism doesn't care, but the caller of burn_my_bmc
@@ -129,8 +134,38 @@ void updaterMain(ipmiblob::BlobInterface* blob, DataInterface* handler,
blob->closeBlob(session);
- /* Trigger the verification. */
- /* Check the verification. */
+ /* Trigger the verification by opening the verify file. */
+ std::fprintf(stderr, "Opening the verification file\n");
+ try
+ {
+ session = blob->openBlob(
+ verifyFilename,
+ static_cast<std::uint16_t>(supported) |
+ static_cast<std::uint16_t>(blobs::OpenFlags::write));
+ }
+ catch (const ipmiblob::BlobException& b)
+ {
+ throw ToolException("blob exception received: " +
+ std::string(b.what()));
+ }
+
+ std::fprintf(
+ stderr,
+ "Committing to verification file to trigger verification service\n");
+ try
+ {
+ blob->commit(session, {});
+ }
+ catch (const ipmiblob::BlobException& b)
+ {
+ throw ToolException("blob exception received: " +
+ std::string(b.what()));
+ }
+
+ /* TODO: Check the verification via stat(session). */
+
+ /* DO NOT CLOSE the verification session until it's done. */
+ blob->closeBlob(session);
return;
}
OpenPOWER on IntegriCloud