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