image_manager: Create error on machine mismatch

Currently the image manager only logs a journal entry if the machine
does not match. Create an error log so that it is easier to the user to
determine what the error is since an error log is exposed via REST and
the web interface. Use the existing ImageFailure error, as it seems
relevant to the machine not matching.

Tested: Verified a new ImageFailure error was created:
$ curl -k -H "X-Auth-Token: $token" \
https://${bmc}/xyz/openbmc_project/logging/entry/2
{
  "data": {
    "AdditionalData": [
      "FAIL=Machine name does not match",
      "PATH=/tmp/images/imageL4OiKL/MANIFEST",
      "_PID=487"
    ],
    "Message": "xyz.openbmc_project.Software.Image.Error.ImageFailure",

$ curl -k -H "X-Auth-Token: $token"
https://${bmc}/xyz/openbmc_project/logging/entry/4
{
  "data": {
    "AdditionalData": [
      "FAIL=MANIFEST is missing machine name",
      "PATH=/tmp/images/imageqwT1cj/MANIFEST",
      "_PID=477"
    ],
    "Message": "xyz.openbmc_project.Software.Image.Error.ImageFailure",

Change-Id: Ie6681acea51e328c4bfe5bbd3af9aff32e8e539d
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/image_manager.cpp b/image_manager.cpp
index dae8fdf..a8f8210 100644
--- a/image_manager.cpp
+++ b/image_manager.cpp
@@ -34,6 +34,7 @@
 using ManifestFail = Software::Image::ManifestFileFailure;
 using UnTarFail = Software::Image::UnTarFailure;
 using InternalFail = Software::Image::InternalFailure;
+using ImageFail = Software::Image::ImageFailure;
 namespace fs = std::filesystem;
 
 struct RemovablePath
@@ -130,6 +131,8 @@
     {
         log<level::ERR>("Failed to read machine name from osRelease",
                         entry("FILENAME=%s", OS_RELEASE_FILE));
+        report<ImageFailure>(ImageFail::FAIL("Failed to read machine name"),
+                             ImageFail::PATH("OS_RELEASE_FILE"));
         return -1;
     }
 
@@ -143,12 +146,18 @@
             log<level::ERR>("BMC upgrade: Machine name doesn't match",
                             entry("CURR_MACHINE=%s", currMachine.c_str()),
                             entry("NEW_MACHINE=%s", machineStr.c_str()));
+            report<ImageFailure>(
+                ImageFail::FAIL("Machine name does not match"),
+                ImageFail::PATH(manifestPath.string().c_str()));
             return -1;
         }
     }
     else
     {
         log<level::WARNING>("No machine name in Manifest file");
+        report<ImageFailure>(
+            ImageFail::FAIL("MANIFEST is missing machine name"),
+            ImageFail::PATH(manifestPath.string().c_str()));
     }
 
     // Get purpose