
On 10/15/2012 12:07 PM, Daniel P. Berrange wrote:
On Fri, Oct 12, 2012 at 09:28:04PM +0200, Martin Kletzander wrote:
This patch adds support for SUSPEND_DISK event; both lifecycle and separated. The support is added for QEMU, machines are changed to PMSUSPENDED, but as QEMU sends SHUTDOWN afterwards, the state changes to shut-off. This and much more needs to be done in order for libvirt to work with transient devices, wake-ups etc. This patch is not aiming for that functionality.
I'm not convinced that we actually need a new PMSUSPEND_DISK event callback. The existing callback:
/** * virConnectDomainEventPMSuspendCallback: * @conn: connection object * @dom: domain on which the event occurred * @reason: reason why the callback was called, unused currently, * always passes 0 * @opaque: application specified data * * This callback occurs when the guest is waken up. * * The callback signature to use when registering for an event of type * VIR_DOMAIN_EVENT_ID_PMSuspend with virConnectDomainEventRegisterAny() */ typedef void (*virConnectDomainEventPMSuspendCallback)(virConnectPtr conn, virDomainPtr dom, int reason, void *opaque);
already has a 'reason' argumnent that is unused, and could be used to distinguish between S3 and S4 (memory vs disk).
Daniel
The problem is that there is only reason field free in the event, but this is not, strictly speaking, a reason, but a type of suspend. The reason could be used to say whether it was suspended y an agent, acpi call, etc., but from what I see elsewhere we don't use it as a type of suspend (disk/memory/hybrid). And as there is no free place in the RPC message for a type of the pmsuspend, I was forced to create a new one. Martin