Create active association
Create an association between an active image
and the active image's version object.
Resolves openbmc/openbmc#2007
Change-Id: I4fd27235db97a3cee87d2da335245e00ec602fba
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/item_updater.hpp b/item_updater.hpp
index 4015760..3489a47 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -5,6 +5,7 @@
#include "version.hpp"
#include <xyz/openbmc_project/Common/FactoryReset/server.hpp>
#include <xyz/openbmc_project/Control/FieldMode/server.hpp>
+#include "org/openbmc/Associations/server.hpp"
namespace phosphor
{
@@ -15,10 +16,14 @@
using ItemUpdaterInherit = sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::Common::server::FactoryReset,
- sdbusplus::xyz::openbmc_project::Control::server::FieldMode>;
+ sdbusplus::xyz::openbmc_project::Control::server::FieldMode,
+ sdbusplus::org::openbmc::server::Associations>;
namespace MatchRules = sdbusplus::bus::match::rules;
+using AssociationList =
+ std::vector<std::tuple<std::string, std::string, std::string>>;
+
/** @class ItemUpdater
* @brief Manages the activation of the BMC version items.
*/
@@ -79,6 +84,20 @@
*/
void erase(std::string entryId);
+
+ /** @brief Creates an active association to the
+ * newly active software image
+ *
+ * @param[in] path - The path to create the association to.
+ */
+ void createActiveAssociation(std::string path);
+
+ /** @brief Removes an active association to the software image
+ *
+ * @param[in] path - The path to remove the association from.
+ */
+ void removeActiveAssociation(std::string path);
+
private:
/** @brief Callback function for Software.Version match.
* @details Creates an Activation dbus object.
@@ -137,6 +156,9 @@
/** @brief sdbusplus signal match for Software.Version */
sdbusplus::bus::match_t versionMatch;
+ /** @brief This entry's associations */
+ AssociationList assocs = {};
+
/** @brief Clears read only partition for
* given Activation dbus object.
*