main: Start the VMM thread

We now start the main VMM thread, which will be listening for VM and IPC
related events.
In order to start the configured VM, we no longer directly call the VM
API but we use the IPC instead, to first create and then start a VM.

Fixes: #303

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-09-25 15:01:49 +02:00
parent e235c6de4f
commit 8188074300
5 changed files with 46 additions and 115 deletions
-26
View File
@@ -383,29 +383,3 @@ impl Vmm {
Ok(exit_behaviour)
}
}
pub fn start_vm_loop(config: Arc<VmConfig>) -> Result<()> {
let exit_evt = EventFd::new(EFD_NONBLOCK).map_err(Error::EventFdCreate)?;
let reset_evt = EventFd::new(EFD_NONBLOCK).map_err(Error::EventFdCreate)?;
loop {
let mut vm = Vm::new(
config.clone(),
exit_evt.try_clone().unwrap(),
reset_evt.try_clone().unwrap(),
)
.expect("Could not create VM");
if vm.start().expect("Could not start VM") == ExitBehaviour::Shutdown {
vm.stop().expect("Could not stop VM");
break;
}
vm.stop().expect("Could not stop VM");
#[cfg(not(feature = "acpi"))]
break;
}
Ok(())
}