update_engine: support downloading DLC
DLC (Downloadable Content) is a new concept that best can be described
as pieces of programs that are considered extensions of the rootfs. Each
DLC resides in the stateful partition and there are two slots for each
DLC (A and B, same as root and kernel partitions.) Each slot is treated
much like the root and kernel partitions themselves. This patch adds
initial support for installing and updating one or multiple DLCs. Each
DLC has a unique APP ID which is constructed such as
${PLATFORM_APPID}_${DLC_ID} where:
PLATFORM_APPID: Is the APP ID currently used for system updates (release
or canary)
DLC_ID: Is a unique ID given to a DLC for its lifetime.
The combination of these two unique IDs will generate a unique APP ID
that can be used for fetching update payloads for DLCs for each board.
Update engine traditionally is used for updating a system to a newer one
using the A/B slots. However, with DLCs residing in the stateful
partition, there is a chance that the stateful partition gets wiped or a
new DLC is required to be installed in the current slot. To solve this
problem, there is a new "Install" operation that allows downloading an
update payload for the current slot with the same version as we are now.
This CL adds AttemptInstall Dbus signal to be used for attempting an DLC
install operation. Furthermore, two new flags are added to the
update_engine_client utility:
--dlc_ids: A colon separated list of DLC IDs.
--install: Requests an install operation rather than an update.
BUG=chromium:879313
TEST=unittest, manual test
CQ-DEPEND=1266235
Change-Id: Ia9c9b702dc9d1bd47fbb10b30969baa0322993f6
Reviewed-on: https://chromium-review.googlesource.com/1195593
Commit-Ready: Xiaochu Liu <[email protected]>
Tested-by: Xiaochu Liu <[email protected]>
Reviewed-by: Amin Hassani <[email protected]>
Reviewed-by: Xiaochu Liu <[email protected]>
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index 4d412ac..c512031 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -2506,7 +2506,7 @@
metrics::DownloadErrorCode::kUnset,
nullptr, // response
&post_data));
- // convert post_data to string
+ // Convert post_data to string.
string post_str(post_data.begin(), post_data.end());
EXPECT_NE(string::npos, post_str.find(
"appid=\"{11111111-1111-1111-1111-111111111111}\" "
@@ -3058,4 +3058,28 @@
EXPECT_FALSE(fake_prefs_.Exists(kPrefsUpdateFirstSeenAt));
}
+TEST_F(OmahaRequestActionTest, InstallTest) {
+ OmahaResponse response;
+ request_params_.set_dlc_ids({"dlc_no_0", "dlc_no_1"});
+ brillo::Blob post_data;
+ ASSERT_TRUE(TestUpdateCheck(fake_update_response_.GetUpdateResponse(),
+ -1,
+ false, // ping_only
+ true, // is_consumer_device
+ 0, // rollback_allowed_milestones
+ false, // is_policy_loaded
+ ErrorCode::kSuccess,
+ metrics::CheckResult::kUpdateAvailable,
+ metrics::CheckReaction::kUpdating,
+ metrics::DownloadErrorCode::kUnset,
+ &response,
+ &post_data));
+ // Convert post_data to string.
+ string post_str(post_data.begin(), post_data.end());
+ for (const auto& dlc_id : request_params_.dlc_ids()) {
+ EXPECT_NE(string::npos,
+ post_str.find("appid=\"test-app-id_" + dlc_id + "\""));
+ }
+}
+
} // namespace chromeos_update_engine