diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2017-07-17 15:24:29 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-07-18 21:43:08 +0000 |
commit | a8eda56300d309cb11566787d70fd1b9a5721e07 (patch) | |
tree | 32e0ebb47684a1995dd36464dc0caf0f7935130a /activation.hpp | |
parent | 167601b5dc570be6e987f2a476a44c6138eb542f (diff) | |
download | openpower-pnor-code-mgmt-a8eda56300d309cb11566787d70fd1b9a5721e07.tar.gz openpower-pnor-code-mgmt-a8eda56300d309cb11566787d70fd1b9a5721e07.zip |
Call emit_interfaces signal for temporary interfaces
When an interface is removed, all the interfaces on that dbus
object are removed because the object class calls object_removed.
The code will be enhanced to handle the removal of interfaces with
openbmc/openbmc#1975 .
In the mean time, for interfaces that are temporary and removed
in the course of the code update flow, do not call emit_object_added
and call emit_interfaces_added and removed when they are created
and destroyed.
Resolves openbmc/openbmc#1917
Change-Id: Ied3f0b613138a78d2ec45b40924c67d92576b2e2
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'activation.hpp')
-rwxr-xr-x | activation.hpp | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/activation.hpp b/activation.hpp index 4ef25621f..458034c96 100755 --- a/activation.hpp +++ b/activation.hpp @@ -51,12 +51,20 @@ class RedundancyPriority : public RedundancyPriorityInherit uint8_t value) : RedundancyPriorityInherit(bus, path.c_str(), true), - parent(parent) + parent(parent), + bus(bus), + path(path) { // Set Property priority(value); - // Emit deferred signal. - emit_object_added(); + std::vector<std::string> interfaces({interface}); + bus.emit_interfaces_added(path.c_str(), interfaces); + } + + ~RedundancyPriority() + { + std::vector<std::string> interfaces({interface}); + bus.emit_interfaces_removed(path.c_str(), interfaces); } /** @brief Overloaded Priority property set function @@ -75,6 +83,13 @@ class RedundancyPriority : public RedundancyPriorityInherit /** @brief Parent Object. */ Activation& parent; + + private: + // TODO Remove once openbmc/openbmc#1975 is resolved + static constexpr auto interface = + "xyz.openbmc_project.Software.RedundancyPriority"; + sdbusplus::bus::bus& bus; + std::string path; }; /** @class ActivationBlocksTransition @@ -92,7 +107,26 @@ class ActivationBlocksTransition : public ActivationBlocksTransitionInherit */ ActivationBlocksTransition(sdbusplus::bus::bus& bus, const std::string& path) : - ActivationBlocksTransitionInherit(bus, path.c_str()) {} + ActivationBlocksTransitionInherit(bus, path.c_str(), true), + bus(bus), + path(path) + { + std::vector<std::string> interfaces({interface}); + bus.emit_interfaces_added(path.c_str(), interfaces); + } + + ~ActivationBlocksTransition() + { + std::vector<std::string> interfaces({interface}); + bus.emit_interfaces_removed(path.c_str(), interfaces); + } + + private: + // TODO Remove once openbmc/openbmc#1975 is resolved + static constexpr auto interface = + "xyz.openbmc_project.Software.ActivationBlocksTransition"; + sdbusplus::bus::bus& bus; + std::string path; }; class ActivationProgress : public ActivationProgressInherit @@ -105,11 +139,27 @@ class ActivationProgress : public ActivationProgressInherit */ ActivationProgress(sdbusplus::bus::bus& bus, const std::string& path) : - ActivationProgressInherit(bus, path.c_str(), true) + ActivationProgressInherit(bus, path.c_str(), true), + bus(bus), + path(path) { progress(0); - emit_object_added(); + std::vector<std::string> interfaces({interface}); + bus.emit_interfaces_added(path.c_str(), interfaces); } + + ~ActivationProgress() + { + std::vector<std::string> interfaces({interface}); + bus.emit_interfaces_removed(path.c_str(), interfaces); + } + + private: + // TODO Remove once openbmc/openbmc#1975 is resolved + static constexpr auto interface = + "xyz.openbmc_project.Software.ActivationProgress"; + sdbusplus::bus::bus& bus; + std::string path; }; /** @class Activation |