summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2017-09-07 13:19:34 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-09-12 21:25:06 +0000
commit43b25cde98b632690990ee3a120be5beff1f21da (patch)
tree146d501f33ed522f924c4741b93e55e14b85973a
parent9440f491c2510cb3d39b702538563a8e39586718 (diff)
downloadphosphor-bmc-code-mgmt-43b25cde98b632690990ee3a120be5beff1f21da.tar.gz
phosphor-bmc-code-mgmt-43b25cde98b632690990ee3a120be5beff1f21da.zip
Create active association on startup
Create active association on startup for active BMC versions. Moved creating the association inside the for loop. The association is only needed if there is an active image so should be inside the for loop to check if it is an active image. Change-Id: Iba7519ba08cb79dc06607caa8b44a0a3022c0ddc Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rw-r--r--item_updater.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/item_updater.cpp b/item_updater.cpp
index 64bd270..4507bcf 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -103,17 +103,18 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg)
auto activationState = server::Activation::Activations::Invalid;
ItemUpdater::ActivationStatus result =
ItemUpdater::validateSquashFSImage(filePath);
+ AssociationList associations = {};
+
if (result == ItemUpdater::ActivationStatus::ready)
{
activationState = server::Activation::Activations::Ready;
+ // Create an association to the BMC inventory item
+ associations.emplace_back(std::make_tuple(
+ ACTIVATION_FWD_ASSOCIATION,
+ ACTIVATION_REV_ASSOCIATION,
+ bmcInventoryPath));
}
- // Create an association to the BMC inventory item
- AssociationList associations{(std::make_tuple(
- ACTIVATION_FWD_ASSOCIATION,
- ACTIVATION_REV_ASSOCIATION,
- bmcInventoryPath))};
-
activations.insert(std::make_pair(
versionId,
std::make_unique<Activation>(
@@ -142,12 +143,6 @@ void ItemUpdater::createActivation(sdbusplus::message::message& msg)
void ItemUpdater::processBMCImage()
{
- // Create an association to the BMC inventory item
- AssociationList associations{(std::make_tuple(
- ACTIVATION_FWD_ASSOCIATION,
- ACTIVATION_REV_ASSOCIATION,
- bmcInventoryPath))};
-
// Read os-release from folders under /media/ to get
// BMC Software Versions.
for(const auto& iter : fs::directory_iterator(MEDIA_DIR))
@@ -181,6 +176,20 @@ void ItemUpdater::processBMCImage()
auto purpose = server::Version::VersionPurpose::BMC;
auto path = fs::path(SOFTWARE_OBJPATH) / id;
+ AssociationList associations = {};
+
+ if (activationState == server::Activation::Activations::Active)
+ {
+ // Create an association to the BMC inventory item
+ associations.emplace_back(std::make_tuple(
+ ACTIVATION_FWD_ASSOCIATION,
+ ACTIVATION_REV_ASSOCIATION,
+ bmcInventoryPath));
+
+ // Create an active association since this image is active
+ createActiveAssociation(path);
+ }
+
// Create Activation instance for this version.
activations.insert(std::make_pair(
id,
OpenPOWER on IntegriCloud