Allow changing VM name on configuration
Adding parameter to change trusty_security_vm_launcher
configuration VM name to be able to use binary to launch
a second VM. Also adding a parameter to cahnge the amount
of memory of the VM.
Bug: 369744744
Test: Boot Cf with 2 VMs using launcher
Change-Id: I9d107a51df631fa872166ae972c9dcf819e0813f
diff --git a/guest/trusty/security_vm/launcher/src/main.rs b/guest/trusty/security_vm/launcher/src/main.rs
index c5cc6b4..bdb4ed8 100644
--- a/guest/trusty/security_vm/launcher/src/main.rs
+++ b/guest/trusty/security_vm/launcher/src/main.rs
@@ -34,6 +34,14 @@
/// Whether the VM is protected or not.
#[arg(long)]
protected: bool,
+
+ /// Name of the VM. Used to pull correct config from early_vms.xml
+ #[arg(long, default_value = "trusty_security_vm_launcher")]
+ name: String,
+
+ /// Memory size of the VM in MiB
+ #[arg(long, default_value_t = 128)]
+ memory_size_mib: i32,
}
fn get_service() -> Result<Strong<dyn IVirtualizationService>> {
@@ -51,10 +59,10 @@
File::open(&args.kernel).with_context(|| format!("Failed to open {:?}", &args.kernel))?;
let vm_config = VirtualMachineConfig::RawConfig(VirtualMachineRawConfig {
- name: "trusty_security_vm_launcher".to_owned(),
+ name: args.name.to_owned(),
kernel: Some(ParcelFileDescriptor::new(kernel)),
protectedVm: args.protected,
- memoryMib: 128,
+ memoryMib: args.memory_size_mib,
platformVersion: "~1.0".to_owned(),
// TODO: add instanceId
..Default::default()