bios: Delete uploaded DBus object after update

When the BIOS code update is completed, delete the uploaded DBus object
so that only the "bios_active" object remains.
Otherwise it leaves the uploaded DBus object that does not reflect a
real thing.

Tested: Verify only bios_active remains and the uploaded BIOS object is
        deleted from DBus, and it is possible to upload and update the
        same BIOS tarball for multieple times.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I18e76238821f48a3b322594bb359fcb37f28f397
diff --git a/activation.cpp b/activation.cpp
index 5490cd9..75d99ff 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -5,6 +5,7 @@
 #include "msl_verify.hpp"
 #include "serialize.hpp"
 
+#include <boost/asio/io_context.hpp>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/elog.hpp>
 #include <phosphor-logging/log.hpp>
@@ -16,6 +17,8 @@
 #include "image_verify.hpp"
 #endif
 
+extern boost::asio::io_context& getIOContext();
+
 namespace phosphor
 {
 namespace software
@@ -431,6 +434,11 @@
             log<level::INFO>("Bios upgrade completed successfully.");
             parent.biosVersion->version(
                 parent.versions.find(versionId)->second->version());
+
+            // Delete the uploaded activation
+            getIOService().post([&parent = parent, versionId = versionId]() {
+                parent.erase(versionId);
+            });
         }
         else if (newStateResult == "failed")
         {