Add memory size to VM config.
Bug: 192294431
Test: atest VirtualizationTestCases
Change-Id: I56d0ba4aca483bada57dd5bea01d1b1ce9b912d5
diff --git a/virtualizationservice/src/crosvm.rs b/virtualizationservice/src/crosvm.rs
index ae8388a..5873cd9 100644
--- a/virtualizationservice/src/crosvm.rs
+++ b/virtualizationservice/src/crosvm.rs
@@ -21,6 +21,7 @@
use log::{debug, error, info};
use shared_child::SharedChild;
use std::fs::{remove_dir_all, File};
+use std::num::NonZeroU32;
use std::os::unix::io::{AsRawFd, RawFd};
use std::path::PathBuf;
use std::process::Command;
@@ -40,6 +41,7 @@
pub disks: Vec<DiskFile>,
pub params: Option<String>,
pub protected: bool,
+ pub memory_mib: Option<NonZeroU32>,
}
/// A disk image to pass to crosvm for a VM.
@@ -173,6 +175,10 @@
command.arg("--protected-vm");
}
+ if let Some(memory_mib) = config.memory_mib {
+ command.arg("--mem").arg(memory_mib.to_string());
+ }
+
if let Some(log_fd) = log_fd {
command.stdout(log_fd);
} else {