Red Hat Bugzilla – Bug 636160
RFE: quit API: Support a domain quit API
Last modified: 2015-01-15 07:21:38 EST
Description of problem:
Support an API for shutting down a guest which is less drastic than virDomainDestroy, but more forceful than virDomainShutdown. This lets QEMU safely flush out any pending data & cleanly shutdown.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Author: Laine Stump <firstname.lastname@example.org>
Date: Fri Jan 27 13:28:23 2012 -0500
qemu: new GRACEFUL flag for virDomainDestroy w/ QEMU support
When libvirt's virDomainDestroy API is shutting down the qemu process,
it first sends SIGTERM, then waits for 1.6 seconds and, if it sees the
process still there, sends a SIGKILL.
There have been reports that this behavior can lead to data loss
because the guest running in qemu doesn't have time to flush its disk
cache buffers before it's unceremoniously whacked.
This patch maintains that default behavior, but provides a new flag
VIR_DOMAIN_DESTROY_GRACEFUL to alter the behavior. If this flag is set
in the call to virDomainDestroyFlags, SIGKILL will never be sent to
the qemu process; instead, if the timeout is reached and the qemu
process still exists, virDomainDestroy will return an error.
Once this patch is in, the recommended method for applications to call
virDomainDestroyFlags will be with VIR_DOMAIN_DESTROY_GRACEFUL
included. If that fails, then the application can decide if and when
to call virDomainDestroyFlags again without
VIR_DOMAIN_DESTROY_GRACEFUL (to force the issue with SIGKILL).
(Note that this does not address the issue of existing applications
that have not yet been modified to use VIR_DOMAIN_DESTROY_GRACEFUL.
That is a separate patch.)