mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
15
src/main.rs
15
src/main.rs
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user