[libvirt] [PATCH 2/2 v3] qemu: Implement DomainPMSuspendForDuration

Eric Blake eblake at redhat.com
Tue Feb 14 17:19:39 UTC 2012


On 02/14/2012 09:45 AM, Michal Privoznik wrote:
> via user agent. Allow targets mem & hybrid iff system_wakeup
> monitor command is available.
> ---
>  src/qemu/qemu_agent.c  |   31 +++++++++++++++++
>  src/qemu/qemu_agent.h  |    2 +
>  src/qemu/qemu_driver.c |   87 ++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 120 insertions(+), 0 deletions(-)
> 

> +static int
> +qemuDomainPMSuspendForDuration(virDomainPtr dom,
> +                               unsigned int target,
> +                               unsigned long long duration,
> +                               unsigned int flags)
> +{

> +    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP) &&
> +        (target == VIR_NODE_SUSPEND_TARGET_MEM ||
> +         target == VIR_NODE_SUSPEND_TARGET_HYBRID)) {
> +       qemuReportError(VIR_ERR_INVALID_ARG, "%s",

I'd make this one VIR_ERR_ARGUMENT_UNSUPPORTED.  The argument was valid
per the documentation, we just can't do it without qemu support.

> +    qemuDomainObjEnterAgent(driver, vm);
> +    ret = qemuAgentSuspend(priv->agent, target);
> +    qemuDomainObjExitAgent(driver, vm);

Since suspending the guest _might_ occur before the agent has a chance
to reply, we may need to consider tweaking either this function, or
qemuAgentSuspend, to treat timeouts in receiving an agent response as a
clue to check whether the suspend happened in the meantime and a chance
to change our reply to success, rather than passing the timeout failure
back to the caller.  But I can live with that as a followup patch,
especially as we clean up things to deal with guest agent timeouts in a
more uniform manner.

> @@ -12235,6 +12321,7 @@ static virDriver qemuDriver = {
>      .domainGetDiskErrors = qemuDomainGetDiskErrors, /* 0.9.10 */
>      .domainSetMetadata = qemuDomainSetMetadata, /* 0.9.10 */
>      .domainGetMetadata = qemuDomainGetMetadata, /* 0.9.10 */
> +    .domainPMSuspendForDuration = qemuDomainPMSuspendForDuration, /* 0.9.10 */

0.9.11, now.

ACK with those two changes.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120214/795f7988/attachment-0001.sig>


More information about the libvir-list mailing list