diff options
author | Saqib Khan <khansa@us.ibm.com> | 2017-09-26 12:11:02 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-10-02 20:20:26 +0000 |
commit | 021c365b73cd9d7d6ad437783821e6ea24bd648e (patch) | |
tree | 652156859f7297ec8917dc98a563a9576a2a8f61 | |
parent | bc1bf3af74d1ecac11dbb763369651bc6bf43db1 (diff) | |
download | phosphor-bmc-code-mgmt-021c365b73cd9d7d6ad437783821e6ea24bd648e.tar.gz phosphor-bmc-code-mgmt-021c365b73cd9d7d6ad437783821e6ea24bd648e.zip |
Delete the BMC version that doesn't have a valid os-release file.
- When a bmc rofs volume is corrupted, it no longer has a valid
os-release. This had caused the BMC.Updater service to core-dump.
We need to delete corrupted volumes in order to prevent such
versions from filling up the space on chip.
Change-Id: I7f23382891dfd9b4dba40ffc1dc3084e088e92b1
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
-rw-r--r-- | item_updater.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/item_updater.cpp b/item_updater.cpp index 9f79963..85fc8ed 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -158,12 +158,16 @@ void ItemUpdater::processBMCImage() if (0 == iter.path().native().compare(0, BMC_RO_PREFIX_LEN, BMC_ROFS_PREFIX)) { + // The versionId is extracted from the path + // for example /media/ro-2a1022fe. + auto id = iter.path().native().substr(BMC_RO_PREFIX_LEN); auto osRelease = iter.path() / OS_RELEASE_FILE; if (!fs::is_regular_file(osRelease)) { log<level::ERR>("Failed to read osRelease\n", entry("FileName=%s", osRelease.string())); - activationState = server::Activation::Activations::Invalid; + ItemUpdater::erase(id); + continue; } auto version = VersionClass::getBMCVersion(osRelease); if (version.empty()) @@ -172,9 +176,7 @@ void ItemUpdater::processBMCImage() entry("FILENAME=%s", osRelease.string())); activationState = server::Activation::Activations::Invalid; } - // The versionId is extracted from the path - // for example /media/ro-2a1022fe - auto id = iter.path().native().substr(BMC_RO_PREFIX_LEN); + auto purpose = server::Version::VersionPurpose::BMC; auto path = fs::path(SOFTWARE_OBJPATH) / id; |