From patchwork Tue Jan 31 19:53:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 138858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9C6B6B71A6 for ; Wed, 1 Feb 2012 06:54:51 +1100 (EST) Received: from localhost ([::1]:60964 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsJmz-0004kp-Qp for incoming@patchwork.ozlabs.org; Tue, 31 Jan 2012 14:54:49 -0500 Received: from eggs.gnu.org ([140.186.70.92]:60105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsJmq-0004jo-4a for qemu-devel@nongnu.org; Tue, 31 Jan 2012 14:54:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RsJml-0003s7-IB for qemu-devel@nongnu.org; Tue, 31 Jan 2012 14:54:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RsJml-0003s3-99 for qemu-devel@nongnu.org; Tue, 31 Jan 2012 14:54:35 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0VJrqCs025993 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 31 Jan 2012 14:53:53 -0500 Received: from localhost (ovpn-116-58.ams2.redhat.com [10.36.116.58]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0VJrpbQ026622; Tue, 31 Jan 2012 14:53:52 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Tue, 31 Jan 2012 17:53:31 -0200 Message-Id: <1328039611-24048-5-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1328039611-24048-1-git-send-email-lcapitulino@redhat.com> References: <1328039611-24048-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: mprivozn@redhat.com, eblake@redhat.com, mdroth@linux.vnet.ibm.com, jcody@redhat.com Subject: [Qemu-devel] [PATCH 4/4] qemu-ga: add guest-suspend-hybrid X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Luiz Capitulino --- qapi-schema-guest.json | 23 +++++++++++++++++++++++ qga/guest-agent-commands.c | 10 ++++++++++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/qapi-schema-guest.json b/qapi-schema-guest.json index cc914ad..9b9ecc9 100644 --- a/qapi-schema-guest.json +++ b/qapi-schema-guest.json @@ -271,3 +271,26 @@ # Since: 1.1 ## { 'command': 'guest-suspend-ram' } + +## +# @guest-suspend-hybrid +# +# Save guest state to disk and suspend to ram. +# +# This command requires the pm-utils package to be installed in the guest. +# +# IMPORTANT: guest-suspend-hybrid requires QEMU to support the 'wakeup' command. +# Thus, it's *required* to query QEMU for the presence of the 'wakeup' command +# before issuing guest-suspend-hybrid. +# +# Returns: nothing on success +# If hybrid suspend is not supported, Unsupported +# +# Notes: o This is an asynchronous request. There's no guarantee a response +# will be sent +# o It's strongly recommended to issue the guest-sync command before +# sending commands when the guest resumes +# +# Since: 1.1 +## +{ 'command': 'guest-suspend-hybrid' } diff --git a/qga/guest-agent-commands.c b/qga/guest-agent-commands.c index 9b04716..9aca5c7 100644 --- a/qga/guest-agent-commands.c +++ b/qga/guest-agent-commands.c @@ -772,6 +772,16 @@ void qmp_guest_suspend_ram(Error **err) guest_suspend("pm-suspend", "mem", err); } +void qmp_guest_suspend_hybrid(Error **err) +{ + bios_supports_mode("pm-is-supported", "--suspend-hybrid", NULL, err); + if (error_is_set(err)) { + return; + } + + guest_suspend("pm-suspend-hybrid", NULL, err); +} + /* register init/cleanup routines for stateful command groups */ void ga_command_state_init(GAState *s, GACommandState *cs) {