summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2018-08-21 15:28:53 +0800
committerLei YU <mine260309@gmail.com>2018-08-30 03:03:05 +0000
commit0f88b5afec39b0fcb31cb5b9692599305cca4c24 (patch)
treee1f350ffb64c92979cfd91cc15e725e0d9d859d8
parent269bff30da8dfabe84d29d6a510bf3b5fdb51fee (diff)
downloadphosphor-bmc-code-mgmt-0f88b5afec39b0fcb31cb5b9692599305cca4c24.tar.gz
phosphor-bmc-code-mgmt-0f88b5afec39b0fcb31cb5b9692599305cca4c24.zip
Delete functional BMC id if ACTIVE_BMC_MAX_ALLOWED is less than 2
The current logic in ItemUpdater::freeSpace() will try to find the non-functional BMC ids and remove extra ones as long as the active BMC images is greater than ACTIVE_BMC_MAX_ALLOWED. For static layout systems with only one BMC flash chip, the above logic will cause an issue that the "old" BMC id not deleted during code update, because the "old" BMC id is the functional one. This commit changes the above logic, that if ACTIVE_BMC_MAX_ALLOWED is less than 2 (e.g. 1), delete the functional BMC id as well, because there really is only one BMC after all. Partly resolves openbmc/phosphor-bmc-code-mgmt#2 Tested: Verify that the "old" BMC id is deleted during code update, if ACTIVE_BMC_MAX_ALLOWED is configured to 1, on Romulus. Change-Id: I6f21b4269dd78d71f7e9181bb913c49b575321d1 Signed-off-by: Lei YU <mine260309@gmail.com>
-rw-r--r--item_updater.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/item_updater.cpp b/item_updater.cpp
index 014757d..6d90579 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -283,7 +283,7 @@ void ItemUpdater::erase(std::string entryId)
auto it = versions.find(entryId);
if (it != versions.end())
{
- if (it->second->isFunctional())
+ if (it->second->isFunctional() && ACTIVE_BMC_MAX_ALLOWED > 1)
{
log<level::ERR>("Error: Version is currently running on the BMC. "
"Unable to remove.",
@@ -599,7 +599,10 @@ void ItemUpdater::freeSpace()
count++;
// Don't put the functional version on the queue since we can't
// remove the "running" BMC version.
- if (versions.find(iter.second->versionId)->second->isFunctional())
+ // 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)
{
continue;
}
OpenPOWER on IntegriCloud