diff options
author | Lei YU <mine260309@gmail.com> | 2019-02-21 15:52:53 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2019-03-08 14:25:30 +0800 |
commit | 9b21efc5b44cd8956325f7856a6ef417aa1d7703 (patch) | |
tree | 636d35cdef9b55a78e5d77539ef63f115ca31bab /activation.hpp | |
parent | eaa9b07637e457392f89e83194b2d818c9dfa9cb (diff) | |
download | openpower-pnor-code-mgmt-9b21efc5b44cd8956325f7856a6ef417aa1d7703.tar.gz openpower-pnor-code-mgmt-9b21efc5b44cd8956325f7856a6ef417aa1d7703.zip |
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>
Diffstat (limited to 'activation.hpp')
-rw-r--r-- | activation.hpp | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/activation.hpp b/activation.hpp index 2fc08d72c..7e8eec5ad 100644 --- a/activation.hpp +++ b/activation.hpp @@ -64,7 +64,7 @@ class RedundancyPriority : public RedundancyPriorityInherit bus.emit_interfaces_added(path.c_str(), interfaces); } - ~RedundancyPriority() + virtual ~RedundancyPriority() { std::vector<std::string> interfaces({interface}); bus.emit_interfaces_removed(path.c_str(), interfaces); @@ -203,6 +203,7 @@ class Activation : public ActivationInherit // Emit deferred signal. emit_object_added(); } + virtual ~Activation() = default; /** @brief Activation property get function * @@ -210,14 +211,6 @@ class Activation : public ActivationInherit */ using ActivationInherit::activation; - /** @brief Overloaded Activation property setter function - * - * @param[in] value - One of Activation::Activations - * - * @return Success or exception thrown - */ - Activations activation(Activations value) override; - /** @brief Overloaded requestedActivation property setter function * * @param[in] value - One of Activation::RequestedActivations @@ -227,16 +220,6 @@ class Activation : public ActivationInherit RequestedActivations requestedActivation(RequestedActivations value) override; - /** @brief Check if systemd state change is relevant to this object - * - * Instance specific interface to handle the detected systemd state - * change - * - * @param[in] msg - Data associated with subscribed signal - * - */ - void unitStateChange(sdbusplus::message::message& msg); - /** * @brief subscribe to the systemd signals * @@ -279,17 +262,23 @@ class Activation : public ActivationInherit /** @brief Used to subscribe to dbus systemd signals **/ sdbusplus::bus::match_t systemdSignals; - /** @brief Tracks whether the read-only & read-write volumes have been - *created as part of the activation process. **/ - bool ubiVolumesCreated = false; - /** @brief activation status property get function * * @returns Activations - The activation value */ using ActivationInherit::activation; - private: + protected: + /** @brief Check if systemd state change is relevant to this object + * + * Instance specific interface to handle the detected systemd state + * change + * + * @param[in] msg - Data associated with subscribed signal + * + */ + virtual void unitStateChange(sdbusplus::message::message& msg) = 0; + /** * @brief Deletes the version from Image Manager and the * untar image from image upload dir. @@ -297,10 +286,10 @@ class Activation : public ActivationInherit void deleteImageManagerObject(); /** @brief Member function for clarity & brevity at activation start */ - void startActivation(); + virtual void startActivation() = 0; /** @brief Member function for clarity & brevity at activation end */ - void finishActivation(); + virtual void finishActivation() = 0; #ifdef WANT_SIGNATURE_VERIFY /** @@ -315,7 +304,7 @@ class Activation : public ActivationInherit * false for unsuccessful signature validation or * any internal failure during the mapper call. */ - inline bool validateSignature(); + bool validateSignature(); /** * @brief Gets the fieldModeEnabled property value. |