This patchset adds a new API to put a host to a suspended state
(Suspend-to-RAM, Suspend-to-Disk or Hybrid-Suspend) and setup a timed resume
to get the host back online, from within libvirt.
This uses the RTC wakeup mechanism to set up a timer alarm before suspending
the host, so that in-band resume is facilitated by the firing of the RTC
alarm, which wakes up the host.
This patch applies on top of the Hybrid-Suspend patch posted in [1].
v5:
* Added MIN_TIME_REQ_FOR_SUSPEND.
* Incorporated the review comments in [3].
v4:
* Applies on top of the Hybrid-Suspend patch posted in [1].
* Incorporated the review comments in [2].
v3:
* Rebased to libvirt 0.9.7
* Added a check to see if alarmTime (suspend duration) is within an
acceptable range.
v2:
* Added an init function which finds out if S3/S4 is supported by the host,
upon the first request to suspend/hibernate.
* Added synchronization/locking to ensure that only one suspend operation
is active at a time.
v1:
http://www.redhat.com/archives/libvir-list/2011-September/msg00830.html
v2:
http://comments.gmane.org/gmane.comp.emulators.libvirt/46729
References:
[1].
http://www.redhat.com/archives/libvir-list/2011-November/msg01407.html
[2].
http://thread.gmane.org/gmane.comp.emulators.libvirt/47950
[3].
http://thread.gmane.org/gmane.comp.emulators.libvirt/49054
Srivatsa S. Bhat (4):
Add a public API to invoke suspend/resume on the host
Add the remote protocol implementation for virNodeSuspendForDuration
Implement the core API to suspend/resume the host
Add virsh command to initiate suspend on the host
include/libvirt/libvirt.h.in | 16 ++
src/Makefile.am | 1
src/driver.h | 6 +
src/libvirt.c | 65 ++++++++++
src/libvirt_private.syms | 5 +
src/libvirt_public.syms | 5 +
src/lxc/lxc_driver.c | 2
src/qemu/qemu_driver.c | 2
src/remote/remote_driver.c | 1
src/remote/remote_protocol.x | 10 +-
src/uml/uml_driver.c | 2
src/util/virnodesuspend.c | 269 ++++++++++++++++++++++++++++++++++++++++++
src/util/virnodesuspend.h | 36 ++++++
src/xen/xen_driver.c | 2
tools/virsh.c | 64 ++++++++++
tools/virsh.pod | 7 +
16 files changed, 491 insertions(+), 2 deletions(-)
create mode 100644 src/util/virnodesuspend.c
create mode 100644 src/util/virnodesuspend.h