From a8eda56300d309cb11566787d70fd1b9a5721e07 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Mon, 17 Jul 2017 15:24:29 -0500 Subject: 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 --- activation.hpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file 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 interfaces({interface}); + bus.emit_interfaces_added(path.c_str(), interfaces); + } + + ~RedundancyPriority() + { + std::vector 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 interfaces({interface}); + bus.emit_interfaces_added(path.c_str(), interfaces); + } + + ~ActivationBlocksTransition() + { + std::vector 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 interfaces({interface}); + bus.emit_interfaces_added(path.c_str(), interfaces); } + + ~ActivationProgress() + { + std::vector 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 -- cgit v1.2.1