aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2022-08-09 19:39:33 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-08-09 19:39:33 +0000
commit7a68e6b20d92a0f6970621a1e6c51748157c25df (patch)
tree7abe7e9fe9b22c3e976bfdbc90d6ccb2b850f90c
parent763dd707f97e372bd570334133721d89128fa18a (diff)
parent44301b6d7fb4c211f5ed6509f0d4e6c6a602000e (diff)
downloadcuttlefish-7a68e6b20d92a0f6970621a1e6c51748157c25df.tar.gz
Merge "Restructure disk choice logic" am: 44301b6d7f
Original change: https://android-review.googlesource.com/c/device/google/cuttlefish/+/2175823 Change-Id: I81e795ca0d98adf6b03ecf34e6b6cb5950fe72b4 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--host/commands/assemble_cvd/flags.cc45
1 files changed, 27 insertions, 18 deletions
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index 136359113..4b4a30a61 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -866,27 +866,36 @@ CuttlefishConfig InitializeCuttlefishConfiguration(
instance.set_camera_server_port(FLAGS_camera_server_port);
- if (FLAGS_protected_vm) {
- instance.set_virtual_disk_paths(
- {const_instance.PerInstancePath("os_composite.img")});
+ std::vector<std::string> virtual_disk_paths;
+
+ bool os_overlay = true;
+ os_overlay &= !FLAGS_protected_vm;
+ // Gem5 already uses CoW wrappers around disk images
+ os_overlay &= FLAGS_vm_manager != Gem5Manager::name();
+ if (os_overlay) {
+ auto path = const_instance.PerInstancePath("overlay.img");
+ virtual_disk_paths.push_back(path);
} else {
- std::vector<std::string> virtual_disk_paths = {
- const_instance.PerInstancePath("persistent_composite.img"),
- };
- if (FLAGS_vm_manager != Gem5Manager::name()) {
- virtual_disk_paths.insert(virtual_disk_paths.begin(),
- const_instance.PerInstancePath("overlay.img"));
- } else {
- // Gem5 already uses CoW wrappers around disk images
- virtual_disk_paths.insert(virtual_disk_paths.begin(),
- const_instance.os_composite_disk_path());
- }
- if (FLAGS_use_sdcard) {
- virtual_disk_paths.push_back(const_instance.sdcard_path());
- }
- instance.set_virtual_disk_paths(virtual_disk_paths);
+ virtual_disk_paths.push_back(const_instance.os_composite_disk_path());
+ }
+
+ bool persistent_disk = true;
+ persistent_disk &= !FLAGS_protected_vm;
+ persistent_disk &= FLAGS_vm_manager != Gem5Manager::name();
+ if (persistent_disk) {
+ auto path = const_instance.PerInstancePath("persistent_composite.img");
+ virtual_disk_paths.push_back(path);
+ }
+
+ bool sdcard = true;
+ sdcard &= FLAGS_use_sdcard;
+ sdcard &= !FLAGS_protected_vm;
+ if (sdcard) {
+ virtual_disk_paths.push_back(const_instance.sdcard_path());
}
+ instance.set_virtual_disk_paths(virtual_disk_paths);
+
// We'd like to set mac prefix to be 5554, 5555, 5556, ... in normal cases.
// When --base_instance_num=3, this might be 5556, 5557, 5558, ... (skipping
// first two)