On Tue, Nov 29, 2011 at 03:12:35AM +0530, Srivatsa S. Bhat wrote:
Add the core functions that implement the functionality of the API.
Suspend is done by using an asynchronous mechanism so that we can return
the status to the caller before the host gets suspended. This asynchronous
operation is achieved by suspending the host in a separate thread of
execution. However, returning the status to the caller is only best-effort,
but not guaranteed.
To resume the host, an RTC alarm is set up (based on how long we want to
suspend) before suspending the host. When this alarm fires, the host gets
woken up.
Suspend-to-RAM operation on a host running Linux can take upto more than 20
seconds, depending on the load of the system. (Freezing of tasks, an operation
preceding any suspend operation, is given up after a 20 second timeout).
And Suspend-to-Disk can take even more time, considering the time required
for compaction, creating the memory image and writing it to disk etc.
So, we do not allow the user to specify a suspend duration of less than 60
seconds, to be on the safer side, since we don't want to prematurely declare
failure when we only had to wait for some more time.
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat(a)linux.vnet.ibm.com>
---
src/Makefile.am | 1
src/libvirt.c | 4 +
src/libvirt_private.syms | 5 +
src/lxc/lxc_driver.c | 2
src/qemu/qemu_driver.c | 2
src/uml/uml_driver.c | 2
src/util/virnodesuspend.c | 269 +++++++++++++++++++++++++++++++++++++++++++++
src/util/virnodesuspend.h | 36 ++++++
src/xen/xen_driver.c | 2
9 files changed, 322 insertions(+), 1 deletions(-)
create mode 100644 src/util/virnodesuspend.c
create mode 100644 src/util/virnodesuspend.h
ACK
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|