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:
Samuel Ortiz
2019-09-24 16:00:00 +02:00
parent 2e0f1c2afe
commit 2e9d815701
3 changed files with 10 additions and 9 deletions

View File

@@ -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);
}