diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2017-09-07 13:13:22 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-09-12 21:24:46 +0000 |
commit | 3588acc8b011f7f39e19ddf77daf5b4e512a37da (patch) | |
tree | 39b22d588ab2d5a8c05fcf8fd124bd9c0ce8d36a | |
parent | 1e0aa5c91bcba3cc2b3d567cc6e1ad1b28ff5418 (diff) | |
download | openpower-pnor-code-mgmt-3588acc8b011f7f39e19ddf77daf5b4e512a37da.tar.gz openpower-pnor-code-mgmt-3588acc8b011f7f39e19ddf77daf5b4e512a37da.zip |
Create active association on startup
Create active association on startup for
active PNOR versions.
Change-Id: I8f7657e6c332759642ecc8f42c9caab14db1289b
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rw-r--r-- | item_updater.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/item_updater.cpp b/item_updater.cpp index 101bc0098..fcec2b1d4 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -96,9 +96,15 @@ void ItemUpdater::createActivation(sdbusplus::message::message& m) { // Determine the Activation state by processing the given image dir. auto activationState = server::Activation::Activations::Invalid; + AssociationList associations = {}; if (ItemUpdater::validateSquashFSImage(filePath) == 0) { activationState = server::Activation::Activations::Ready; + // Create an association to the host inventory item + associations.emplace_back(std::make_tuple( + ACTIVATION_FWD_ASSOCIATION, + ACTIVATION_REV_ASSOCIATION, + HOST_INVENTORY_PATH)); } fs::path manifestPath(filePath); @@ -107,12 +113,6 @@ void ItemUpdater::createActivation(sdbusplus::message::message& m) std::map<std::string, std::string> {{"extended_version", ""}})).begin()->second; - // Create an association to the host inventory item - AssociationList associations{(std::make_tuple( - ACTIVATION_FWD_ASSOCIATION, - ACTIVATION_REV_ASSOCIATION, - HOST_INVENTORY_PATH))}; - activations.insert(std::make_pair( versionId, std::make_unique<Activation>( @@ -187,13 +187,19 @@ void ItemUpdater::processPNORImage() auto id = iter.path().native().substr(PNOR_RO_PREFIX_LEN); auto purpose = server::Version::VersionPurpose::Host; auto path = fs::path(SOFTWARE_OBJPATH) / id; + AssociationList associations = {}; - - // Create an association to the host inventory item - AssociationList associations{(std::make_tuple( - ACTIVATION_FWD_ASSOCIATION, - ACTIVATION_REV_ASSOCIATION, - HOST_INVENTORY_PATH))}; + if (activationState == server::Activation::Activations::Active) + { + // Create an association to the host inventory item + associations.emplace_back(std::make_tuple( + ACTIVATION_FWD_ASSOCIATION, + ACTIVATION_REV_ASSOCIATION, + HOST_INVENTORY_PATH)); + + // Create an active association since this image is active + createActiveAssociation(path); + } // Create Activation instance for this version. activations.insert(std::make_pair( |