diff options
author | Jae Hoon Kim <kimjae@chromium.org> | 2020-06-01 14:24:08 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-12 09:07:32 +0000 |
commit | 694eeb0dece40f88e11ece3a776d995d855be79b (patch) | |
tree | 9daed0441e3454dec1f5b7f377b8b053a6f4bdf9 /payload_state.cc | |
parent | 3562a5da1ef2d7280320167e0bd56a77e02ed4ff (diff) |
update_engine: Add PayloadState Exclusion Logic
|PayloadState| will exclude payloads based on specific update failures.
This is to prevent critical platform updates from being blocked by less
critical updates (e.g. DLCs). A layer of robustness is added in
protecting CrOS devices from falling off the update train.
Some important changes to mention:
- Only during updates will update_engine exclude non-critical payloads
- |OmahaRequestAction|, the current precursor |Action| to
|OmahaResponseHandlerAction|, during a update will exclude
faulty/excluded payloads prior to setting the |OmahaResponse| as an
output object for suqsequent bonded |Action| to consume
- When all payloads are excluded for an update, the |ErrorCode| will
be indicated as |OmahaResponseInvalid| as this case is not a valid
Omaha response update_engine should ever run into because non-critical
updates must tag alongside a critical update
BUG=chromium:928805
TEST=FEATURES=test emerge-$B update_engine update_engine-client
Change-Id: I0551a228d0b84defb4d59966e8ed46a5d9278d60
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2190237
Tested-by: Jae Hoon Kim <kimjae@chromium.org>
Auto-Submit: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
Diffstat (limited to 'payload_state.cc')
-rw-r--r-- | payload_state.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/payload_state.cc b/payload_state.cc index 2e07ad97..cf3aab91 100644 --- a/payload_state.cc +++ b/payload_state.cc @@ -312,6 +312,7 @@ void PayloadState::UpdateFailed(ErrorCode error) { case ErrorCode::kUnsupportedMinorPayloadVersion: case ErrorCode::kPayloadTimestampError: case ErrorCode::kVerityCalculationError: + ExcludeCurrentPayload(); IncrementUrlIndex(); break; @@ -502,10 +503,29 @@ void PayloadState::IncrementFailureCount() { } else { LOG(INFO) << "Reached max number of failures for Url" << GetUrlIndex() << ". Trying next available URL"; + ExcludeCurrentPayload(); IncrementUrlIndex(); } } +void PayloadState::ExcludeCurrentPayload() { + const auto& package = response_.packages[payload_index_]; + if (!package.can_exclude) { + LOG(INFO) << "Not excluding as marked non-excludable for package hash=" + << package.hash; + return; + } + auto exclusion_name = utils::GetExclusionName(GetCurrentUrl()); + if (!excluder_->Exclude(exclusion_name)) + LOG(WARNING) << "Failed to exclude " + << " Package Hash=" << package.hash + << " CurrentUrl=" << GetCurrentUrl(); + else + LOG(INFO) << "Excluded " + << " Package Hash=" << package.hash + << " CurrentUrl=" << GetCurrentUrl(); +} + void PayloadState::UpdateBackoffExpiryTime() { if (response_.disable_payload_backoff) { LOG(INFO) << "Resetting backoff expiry time as payload backoff is disabled"; |