Refactor: Split Activation into common and ubi
Activations has a few functions coupled with ubi, split them into
ubi/activation_ubi
* Keep common code in activation.
* Make start/finishActivation() pure virtual.
* Move ubi specific code into ubi.
* Move ubiVolumnCreated into ubi.
* Make validateSignature() not inline, otherwise it gets compile error.
Tested: On the last commit of the patch series, run code update and
factory reset on Witherspoon and all work fine.
Change-Id: I7c8a0de6b0be4b1e9814ea75fd802a014b4aacfc
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/ubi/activation_ubi.hpp b/ubi/activation_ubi.hpp
new file mode 100644
index 0000000..a17bb82
--- /dev/null
+++ b/ubi/activation_ubi.hpp
@@ -0,0 +1,61 @@
+#pragma once
+
+#include "activation.hpp"
+
+namespace openpower
+{
+namespace software
+{
+namespace updater
+{
+
+class RedundancyPriorityUbi : public RedundancyPriority
+{
+ public:
+ using RedundancyPriority::RedundancyPriority;
+ virtual ~RedundancyPriorityUbi() = default;
+
+ /** @brief Overloaded Priority property set function
+ *
+ * @param[in] value - uint8_t
+ *
+ * @return Success or exception thrown
+ */
+ uint8_t priority(uint8_t value) override;
+};
+
+/** @class ActivationUbi
+ * @brief OpenBMC activation software management implementation.
+ * @details A concrete implementation for
+ * xyz.openbmc_project.Software.Activation DBus API.
+ */
+class ActivationUbi : public Activation
+{
+ public:
+ using Activation::Activation;
+ virtual ~ActivationUbi() = default;
+
+ /** @brief Overloaded Activation property setter function
+ *
+ * @param[in] value - One of Activation::Activations
+ *
+ * @return Success or exception thrown
+ */
+ Activations activation(Activations value) override;
+
+ RequestedActivations
+ requestedActivation(RequestedActivations value) override;
+
+ private:
+ /** @brief Tracks whether the read-only & read-write volumes have been
+ *created as part of the activation process. **/
+ bool ubiVolumesCreated = false;
+
+ void unitStateChange(sdbusplus::message::message& msg) override;
+ void startActivation() override;
+ void finishActivation() override;
+};
+
+} // namespace updater
+} // namespace software
+} // namespace openpower