summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activation.cpp4
-rw-r--r--item_updater.cpp23
-rw-r--r--item_updater.hpp4
3 files changed, 22 insertions, 9 deletions
diff --git a/activation.cpp b/activation.cpp
index dc1993e..a938b8b 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -86,7 +86,7 @@ auto Activation::activation(Activations value) -> Activations
// Enable systemd signals
Activation::subscribeToSystemdSignals();
- parent.freeSpace();
+ parent.freeSpace(*this);
if (!activationProgress)
{
@@ -170,7 +170,7 @@ auto Activation::activation(Activations value) -> Activations
}
}
#endif
- parent.freeSpace();
+ parent.freeSpace(*this);
flashWrite();
diff --git a/item_updater.cpp b/item_updater.cpp
index 0fd2345..90a97d4 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -583,7 +583,7 @@ void ItemUpdater::resetUbootEnvVars()
updateUbootEnvVars(lowestPriorityVersion);
}
-void ItemUpdater::freeSpace()
+void ItemUpdater::freeSpace(Activation& caller)
{
// Versions with the highest priority in front
std::priority_queue<std::pair<int, std::string>,
@@ -604,14 +604,25 @@ void ItemUpdater::freeSpace()
// remove the "running" BMC version.
// If ACTIVE_BMC_MAX_ALLOWED <= 1, there is only one active BMC,
// so remove functional version as well.
- if (versions.find(iter.second->versionId)->second->isFunctional() &&
- ACTIVE_BMC_MAX_ALLOWED > 1)
+ // Don't delete the the Activation object that called this function.
+ if ((versions.find(iter.second->versionId)
+ ->second->isFunctional() &&
+ ACTIVE_BMC_MAX_ALLOWED > 1) ||
+ (iter.second->versionId == caller.versionId))
{
continue;
}
- versionsPQ.push(std::make_pair(
- iter.second->redundancyPriority.get()->priority(),
- iter.second->versionId));
+
+ // Failed activations don't have priority, assign them a large value
+ // for sorting purposes.
+ auto priority = 999;
+ if (iter.second.get()->activation() ==
+ server::Activation::Activations::Active)
+ {
+ priority = iter.second->redundancyPriority.get()->priority();
+ }
+
+ versionsPQ.push(std::make_pair(priority, iter.second->versionId));
}
}
diff --git a/item_updater.hpp b/item_updater.hpp
index 12583f5..ac966ca 100644
--- a/item_updater.hpp
+++ b/item_updater.hpp
@@ -143,8 +143,10 @@ class ItemUpdater : public ItemUpdaterInherit
* needs to delete any BMC version(s) it will delete the
* version(s) with the highest priority, skipping the
* functional BMC version.
+ *
+ * @param[in] caller - The Activation object that called this function.
*/
- void freeSpace();
+ void freeSpace(Activation& caller);
private:
/** @brief Callback function for Software.Version match.
OpenPOWER on IntegriCloud