vm: If a VCPU thread errors out then exit the hypervisor

Currently when the VCPU thread exits on an error the VMM continues to
run with no way of shutting down the main thread.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2019-08-19 18:12:05 +01:00 committed by Samuel Ortiz
parent 98f81c36ec
commit 451502b50b

View File

@ -1781,6 +1781,7 @@ impl<'a> Vm<'a> {
let vcpu_thread_barrier = vcpu_thread_barrier.clone();
let exit_evt = self.devices.exit_evt.try_clone().unwrap();
self.vcpus.push(
thread::Builder::new()
.name(format!("cloud-hypervisor_vcpu{}", vcpu.id))
@ -1802,6 +1803,7 @@ impl<'a> Vm<'a> {
vcpu_thread_barrier.wait();
while vcpu.run().is_ok() {}
exit_evt.write(1).unwrap();
})
.map_err(Error::VcpuSpawn)?,
);