cloud-hypervisor: Add the --memory option

You guessed it: To specify the amount of memory for the VM.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-03-11 17:48:35 +01:00
parent 59b5e53c40
commit 25f4063da6
2 changed files with 18 additions and 5 deletions

View File

@@ -31,6 +31,12 @@ fn main() {
.help("Number of virtual CPUs")
.takes_value(true),
)
.arg(
Arg::with_name("memory")
.long("memory")
.help("Amount of RAM (in MB)")
.takes_value(true),
)
.get_matches();
let kernel_arg = cmd_arguments
@@ -45,10 +51,15 @@ fn main() {
vcpus = cpus.parse::<u8>().unwrap();
}
println!("VM [{} vCPUS]", vcpus);
let mut memory = DEFAULT_MEMORY;
if let Some(mem) = cmd_arguments.value_of("memory") {
memory = mem.parse::<u64>().unwrap();
}
println!("VM [{} vCPUS {} MB of memory]", vcpus, memory);
println!("Booting {:?}...", kernel_path);
let vm_config = VmConfig::new(kernel_path, vcpus).unwrap();
let vm_config = VmConfig::new(kernel_path, vcpus, memory).unwrap();
vmm::boot_kernel(vm_config).unwrap();
}