diff options
author | Saqib Khan <khansa@us.ibm.com> | 2017-10-22 11:29:07 -0500 |
---|---|---|
committer | Saqib Khan <khansa@us.ibm.com> | 2017-12-05 16:55:30 -0600 |
commit | 7f80e0b534b91b3a868f33934d92024427235e89 (patch) | |
tree | df60b8ca6f4f5faf8257c6fa49fe0d1257ff3908 /version.cpp | |
parent | 5b75651b350476455d3c2b6f948a273b1438a790 (diff) | |
download | openpower-pnor-code-mgmt-7f80e0b534b91b3a868f33934d92024427235e89.tar.gz openpower-pnor-code-mgmt-7f80e0b534b91b3a868f33934d92024427235e89.zip |
PNOR: Fix the delete implementation
- In order to remove the delete object from functional
image, the delete interface is moved inside the
version class so that both item_updater and image_manager
can make use of the same implementation.
- To avoid having two delete objects attached to the same
HOST version (item_updater and image_manager), we are now
deleting the image_manager object once the activation
is complete.
Partially resolves openbmc/openbmc#2490
Change-Id: Ie515cc01d5f154e6e55b9a3fb71d831730cd46f6
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
Diffstat (limited to 'version.cpp')
-rw-r--r-- | version.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/version.cpp b/version.cpp index 5dbab3508..c8fe7cf95 100644 --- a/version.cpp +++ b/version.cpp @@ -93,6 +93,46 @@ std::map<std::string, std::string> Version::getValue( return keys; } +void Delete::delete_() +{ + if (parent.eraseCallback) + { + parent.eraseCallback(parent.getId(parent.version())); + } +} + +void Version::updateDeleteInterface(sdbusplus::message::message& msg) +{ + std::string interface, chassisState; + std::map<std::string, sdbusplus::message::variant<std::string>> properties; + + msg.read(interface, properties); + + for (const auto& p : properties) + { + if (p.first == "CurrentPowerState") + { + chassisState = p.second.get<std::string>(); + } + } + + if ((parent.isVersionFunctional(this->versionId)) && + (chassisState != CHASSIS_STATE_OFF)) + { + if (deleteObject) + { + deleteObject.reset(nullptr); + } + } + else + { + if (!deleteObject) + { + deleteObject = std::make_unique<Delete>(bus, objPath, *this); + } + } +} + } // namespace updater } // namespace software } // namespace openpower |