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>
diff --git a/activation.hpp b/activation.hpp
index 4ef2562..458034c 100755
--- a/activation.hpp
+++ b/activation.hpp
@@ -51,12 +51,20 @@
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 @@
/** @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 @@
*/
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 @@
*/
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