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@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org