mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-25 17:31:16 +00:00
vmm: Make sure to retry creating the VM on EINTR
If the ioctl syscall KVM_CREATE_VM gets interrupted while creating the VM, it is expected that we should retry since EINTR should not be considered a standard error. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
671b49ba23
commit
62ccccc303
@ -241,7 +241,24 @@ impl Vm {
|
|||||||
|
|
||||||
let kernel = File::open(&config.lock().unwrap().kernel.as_ref().unwrap().path)
|
let kernel = File::open(&config.lock().unwrap().kernel.as_ref().unwrap().path)
|
||||||
.map_err(Error::KernelFile)?;
|
.map_err(Error::KernelFile)?;
|
||||||
let fd = kvm.create_vm().map_err(Error::VmCreate)?;
|
|
||||||
|
let fd: VmFd;
|
||||||
|
loop {
|
||||||
|
match kvm.create_vm() {
|
||||||
|
Ok(res) => fd = res,
|
||||||
|
Err(e) => {
|
||||||
|
if e.errno() == libc::EINTR {
|
||||||
|
// If the error returned is EINTR, which means the
|
||||||
|
// ioctl has been interrupted, we have to retry as
|
||||||
|
// this can't be considered as a regular error.
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
return Err(Error::VmCreate(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
let fd = Arc::new(fd);
|
let fd = Arc::new(fd);
|
||||||
|
|
||||||
// Set TSS
|
// Set TSS
|
||||||
|
Loading…
Reference in New Issue
Block a user