mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Add support for resuming automatically on restore
Add an option that can be used when restoring to resume the VM. This is particularly useful when restoring the VM via the direct VMM command line, when you might not want/have an API socket configured. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
+12
-6
@@ -1849,16 +1849,22 @@ impl RequestHandler for Vmm {
|
||||
restore_cfg.prefault,
|
||||
restore_cfg.memory_restore_mode,
|
||||
)
|
||||
.map_err(|vm_restore_err| {
|
||||
error!("VM Restore failed: {vm_restore_err:?}");
|
||||
|
||||
// Cleanup the VM being created while vm restore
|
||||
.and_then(|()| {
|
||||
if restore_cfg.resume {
|
||||
self.vm_resume()
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
})
|
||||
.map_err(|e| {
|
||||
error!("VM Restore failed: {e:?}");
|
||||
if let Err(e) = self.vm_delete() {
|
||||
return e;
|
||||
}
|
||||
e
|
||||
})?;
|
||||
|
||||
vm_restore_err
|
||||
})
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", feature = "guest_debug"))]
|
||||
|
||||
Reference in New Issue
Block a user