Features/Virt Guest Suspend Hibernate
Virt Guest Suspend/Hibernate support
Linux guests don't do S3/S4 properly right now due to missing functionality in the virtio layer to save state before hibernation and restore it after resume. The plan is to extend virtio and individual virtio drivers to handle hibernation, as well as userspace components like libvirt + qemu to enable everything.
- Targeted release: Fedora 18
- Last updated: June 6 2012
- Percentage of completion: 80%
Hibernation is a standard feature on most OSes. Users can put the OS is a hibernation mode, switch off the computer, and later, on the next restart, continue from where they left off, including all their open browsing sessions and document editors. So far, Linux guests with virtio drivers haven't been able to resume properly after hibernation. This work will fix that, and users will be able to experience hibernation as they are used to on KVM-optimised paravirtual guests.
In addition, this feature tracks libvirt and qemu-ga additions that enable suspending/hibernating a VM from the host command line.
Benefit to Fedora
- Virtual machines act more like physical machines, which allows for better testing of the distro in a VM.
- Interesting feature to market for F18.
- Kernel suspend/resume support for virtio (DONE)
- S3/S4 Support in QEMU, Seabios (DONE, qemu 1.1)
- qemu guest agent API commands for s3/s4 (DONE, qemu 1.1)
- enable s3/s4 in seabios (not done? currently disabled with a patch in f17 due to some usability confusion)
- API for initiating guest s3/s4, virsh support (DONE)
- s3/s4 guest event support (unknown, probably not a requirement)
- ovirt usage (unknown)
- virt-manager usage (none, but probably not a requirement)
- get qemu 1.1 into Fedora (DONE)
I think this means doing a 'virsh shutdown $vmname' on default Fedora gnome install will initiate a suspend though, where previously it would not. If qemu-ga is installed and configured, shutdown will work correctly. So maybe we just need to make sure all tools are setting up qemu-ga for new guests.
How To Test
From inside the guest, initiating suspend and hibernate should succeed. For a Fedora guest, this will be the command line utils
The guest should then appear as running (or shutoff? I need to confirm). XXX: how to we wake up the guest
To initiate a suspend from the host on a VM, you can do:
virsh dompmsuspend --target mem
For hibernate, do
virsh dompmsuspend --target disk
Virt users will now actually be able to suspend or hibernate their VMs like they would on a physical machine.
Kernel 3.4, which is already queued for F17. qemu 1.1, already in rawhide.
Since this is brand new functionality, if it doesn't make it in time for F18, nothing has changed. We just drop this feature page.
- Suspend and hibernate now works from within KVM virtual machines. These can also be invoked on virtual machines from the host using virsh.