summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2017-09-14 12:30:27 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-09-27 13:57:40 +0000
commit833e4f3788dde8b3111fd97fcdbe67267fffdfb3 (patch)
treea9ceb2e24e8aa444d7a5d08a0cd5d3c56e43b34d
parenta93a07b3922aa12334f0a728cb9325633a4415a0 (diff)
downloadopenpower-pnor-code-mgmt-833e4f3788dde8b3111fd97fcdbe67267fffdfb3.tar.gz
openpower-pnor-code-mgmt-833e4f3788dde8b3111fd97fcdbe67267fffdfb3.zip
Create PNOR Functional Association
Created the function updateFunctionalAssociation to update the functional association for the "running" PNOR image. This function will be called by the inotify code. Change-Id: I871624044fbb11800de4d13e6a4b174494c68f13 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rwxr-xr-xconfigure.ac3
-rw-r--r--item_updater.cpp23
-rwxr-xr-xitem_updater.hpp7
3 files changed, 32 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 25629caa9..4996623b0 100755
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,9 @@ AC_DEFINE(HOST_INVENTORY_PATH, "/xyz/openbmc_project/inventory/system/chassis",
AC_DEFINE(ACTIVE_FWD_ASSOCIATION, "active", [The name of the active's forward association.])
AC_DEFINE(ACTIVE_REV_ASSOCIATION, "software_version", [The name of the active's reverse association.])
+AC_DEFINE(FUNCTIONAL_FWD_ASSOCIATION, "functional", [The name of the functional forward association.])
+AC_DEFINE(FUNCTIONAL_REV_ASSOCIATION, "software_version", [The functional reverse association.])
+
AC_DEFINE(VERSION_IFACE, "xyz.openbmc_project.Software.Version",
[The software version manager interface])
AC_DEFINE(FILEPATH_IFACE, "xyz.openbmc_project.Common.FilePath",
diff --git a/item_updater.cpp b/item_updater.cpp
index 1539f95c9..d0a3562d0 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -494,11 +494,32 @@ void ItemUpdater::createActiveAssociation(std::string path)
associations(assocs);
}
+void ItemUpdater::updateFunctionalAssociation(const std::string& path)
+{
+ // remove all functional associations
+ for (auto iter = assocs.begin(); iter != assocs.end();)
+ {
+ if ((std::get<0>(*iter)).compare(FUNCTIONAL_FWD_ASSOCIATION) == 0)
+ {
+ iter = assocs.erase(iter);
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+ assocs.emplace_back(std::make_tuple(FUNCTIONAL_FWD_ASSOCIATION,
+ FUNCTIONAL_REV_ASSOCIATION,
+ path));
+ associations(assocs);
+}
+
void ItemUpdater::removeActiveAssociation(std::string path)
{
for (auto iter = assocs.begin(); iter != assocs.end();)
{
- if ((std::get<2>(*iter)).compare(path) == 0)
+ if ((std::get<0>(*iter)).compare(ACTIVE_FWD_ASSOCIATION) == 0 &&
+ (std::get<2>(*iter)).compare(path) == 0)
{
iter = assocs.erase(iter);
associations(assocs);
diff --git a/item_updater.hpp b/item_updater.hpp
index 8e6637ad9..5d2a15eac 100755
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -91,6 +91,13 @@ class ItemUpdater : public ItemUpdaterInherit
*/
void createActiveAssociation(std::string path);
+ /** @brief Updates the functional association to the
+ * new "running" PNOR image
+ *
+ * @param[in] path - The path to update the association to.
+ */
+ void updateFunctionalAssociation(const std::string& path);
+
/** @brief Removes an active association to the software image
*
* @param[in] path - The path to remove the association from.
OpenPOWER on IntegriCloud