commit | 45bcb0c3950a155c5bd407d939932a2491e55f06 | [log] [tgz] |
---|---|---|
author | Andrew Walbran <qwandor@google.com> | Wed Jul 14 15:02:06 2021 +0000 |
committer | Andrew Walbran <qwandor@google.com> | Tue Jul 27 10:33:05 2021 +0000 |
tree | 53caea27a441461f3ded651008861c08ece7d649 | |
parent | 9ae4b5cfb756052ed3bcc68f7484327e896a4ad1 [diff] |
Allow VM memory to be specified in app config. Bug: 192294431 Change-Id: I42c8bb001e8c1e8905939bee01cd2d341b11f1a9
diff --git a/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineAppConfig.aidl b/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineAppConfig.aidl index a5f7c3c..9339f82 100644 --- a/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineAppConfig.aidl +++ b/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineAppConfig.aidl
@@ -31,4 +31,10 @@ /** Whether to run the VM in debug mode or not */ boolean debug; + + /** + * The amount of RAM to give the VM, in MiB. If this is 0 or negative then it will default to + * the value in microdroid.json, if any, or the crosvm default. + */ + int memory_mib; }
diff --git a/virtualizationservice/src/aidl.rs b/virtualizationservice/src/aidl.rs index 1d99c2d..19e4877 100644 --- a/virtualizationservice/src/aidl.rs +++ b/virtualizationservice/src/aidl.rs
@@ -383,6 +383,10 @@ let vm_config_file = File::open(vm_config_path)?; let mut vm_config = VmConfig::load(&vm_config_file)?.to_parcelable()?; + if config.memory_mib > 0 { + vm_config.memory_mib = config.memory_mib; + } + // Microdroid requires an additional payload disk image and the bootconfig partition. if os_name == "microdroid" { let apexes = vm_payload_config.apexes.clone();