summaryrefslogtreecommitdiffstats
path: root/item_updater.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'item_updater.cpp')
-rwxr-xr-xitem_updater.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/item_updater.cpp b/item_updater.cpp
index c6726d37b..dd313a8c6 100755
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -355,6 +355,33 @@ void ItemUpdater::erase(std::string entryId)
activations.erase(entryId);
}
+// TODO: openbmc/openbmc#1402 Monitor flash usage
+void ItemUpdater::freeSpace()
+{
+ std::size_t count = 0;
+ decltype(activations.begin()->second->redundancyPriority.get()->priority())
+ highestPriority = 0;
+ decltype(activations.begin()->second->versionId) highestPriorityVersion;
+ for (const auto& iter : activations)
+ {
+ if (iter.second.get()->activation() == server::Activation::Activations::Active)
+ {
+ count++;
+ if (iter.second->redundancyPriority.get()->priority() > highestPriority)
+ {
+ highestPriority = iter.second->redundancyPriority.get()->priority();
+ highestPriorityVersion = iter.second->versionId;
+ }
+ }
+ }
+ // Remove the pnor version with highest priority since the PNOR
+ // can't hold more than 2 versions.
+ if (count >= ACTIVE_PNOR_MAX_ALLOWED)
+ {
+ erase(highestPriorityVersion);
+ }
+}
+
} // namespace updater
} // namespace software
} // namespace openpower
OpenPOWER on IntegriCloud