mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Use a reference counted VmConfig when creating a new VM
Once passed to the VM creation routine, a VmConfig structure is immutable. We can simply carry a Arc of it instead of a reference. This also allows us to remove any lifetime bound from our VM. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
@@ -11,7 +11,7 @@ extern crate clap;
|
||||
use clap::{App, Arg};
|
||||
use log::LevelFilter;
|
||||
use std::process;
|
||||
use std::sync::Mutex;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use vmm::config;
|
||||
|
||||
struct Logger {
|
||||
@@ -285,7 +285,7 @@ fn main() {
|
||||
vm_config.disks,
|
||||
);
|
||||
|
||||
if let Err(e) = vmm::start_vm_loop(vm_config) {
|
||||
if let Err(e) = vmm::start_vm_loop(Arc::new(vm_config)) {
|
||||
println!("Guest boot failed: {}", e);
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user