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:
Rob Bradford
2026-03-17 09:30:01 -07:00
parent f4772e7f4c
commit 068b5ecb63
4 changed files with 108 additions and 34 deletions
+12 -6
View File
@@ -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"))]