diff options
author | Saqib Khan <khansa@us.ibm.com> | 2017-09-26 12:02:50 -0500 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-10-02 17:26:38 +0000 |
commit | 6a52226d5e43d8a5c0f300af0322ae65283463dd (patch) | |
tree | dcf9867da646b435af585eb1adfed5128ab8ea2d | |
parent | 2be9ba900086c319ab6553baef347211892976bc (diff) | |
download | openpower-pnor-code-mgmt-6a52226d5e43d8a5c0f300af0322ae65283463dd.tar.gz openpower-pnor-code-mgmt-6a52226d5e43d8a5c0f300af0322ae65283463dd.zip |
Delete the pnor version that doesn't have a valid pnor.toc
- When a pnor ro volume is corrupted, it no longer has a valid
pnor.toc. This had caused the Host.Updater service to core-dump.
We need to delete corrupted volumes in order to prevent such
versions from filling up the space on chip.
Resolves openbmc/openbmc#2359
Change-Id: I173409b03f9f7a38fb30e4c8b2eac19064cece70
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
-rw-r--r-- | item_updater.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/item_updater.cpp b/item_updater.cpp index e9a283d70..7692293af 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -164,12 +164,16 @@ void ItemUpdater::processPNORImage() if (0 == iter.path().native().compare(0, PNOR_RO_PREFIX_LEN, PNOR_RO_PREFIX)) { + // The versionId is extracted from the path + // for example /media/pnor-ro-2a1022fe. + auto id = iter.path().native().substr(PNOR_RO_PREFIX_LEN); auto pnorTOC = iter.path() / PNOR_TOC_FILE; if (!fs::is_regular_file(pnorTOC)) { - log<level::ERR>("Failed to read pnorTOC\n", + log<level::ERR>("Failed to read pnorTOC.\n", entry("FileName=%s", pnorTOC.string())); - activationState = server::Activation::Activations::Invalid; + ItemUpdater::erase(id); + continue; } auto keyValues = Version::getValue(pnorTOC, @@ -191,9 +195,6 @@ void ItemUpdater::processPNORImage() activationState = server::Activation::Activations::Invalid; } - // The versionId is extracted from the path - // for example /media/pnor-ro-2a1022fe - auto id = iter.path().native().substr(PNOR_RO_PREFIX_LEN); auto purpose = server::Version::VersionPurpose::Host; auto path = fs::path(SOFTWARE_OBJPATH) / id; AssociationList associations = {}; |