From patchwork Wed Jan 9 15:18:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Hrdina X-Patchwork-Id: 210732 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1F0962C0109 for ; Thu, 10 Jan 2013 02:40:35 +1100 (EST) Received: from localhost ([::1]:39138 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsxQp-0007bt-7s for incoming@patchwork.ozlabs.org; Wed, 09 Jan 2013 10:19:07 -0500 Received: from eggs.gnu.org ([208.118.235.92]:55574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsxQB-000691-Lw for qemu-devel@nongnu.org; Wed, 09 Jan 2013 10:18:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TsxQ5-0005Dn-8X for qemu-devel@nongnu.org; Wed, 09 Jan 2013 10:18:27 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TsxQ4-0005Db-Vj for qemu-devel@nongnu.org; Wed, 09 Jan 2013 10:18:21 -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 r09FIKfm030804 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 Jan 2013 10:18:20 -0500 Received: from localhost.localdomain.com (dhcp-27-154.brq.redhat.com [10.34.27.154]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r09FI9ck021430; Wed, 9 Jan 2013 10:18:19 -0500 From: Pavel Hrdina To: qemu-devel@nongnu.org Date: Wed, 9 Jan 2013 16:18:00 +0100 Message-Id: <705f46ef0a25d5c793b8a9884542527c0b374f5e.1357741229.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Pavel Hrdina , phrdina@redhat.c0m, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH 06/13] savevm: add error parameter to qemu_savevm_state() 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: Pavel Hrdina --- savevm.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/savevm.c b/savevm.c index 14f61e9..b705693 100644 --- a/savevm.c +++ b/savevm.c @@ -1759,7 +1759,7 @@ void qemu_savevm_state_cancel(QEMUFile *f) } } -static int qemu_savevm_state(QEMUFile *f) +static int qemu_savevm_state(QEMUFile *f, Error **errp) { int ret; MigrationParams params = { @@ -1767,26 +1767,29 @@ static int qemu_savevm_state(QEMUFile *f) .shared = 0 }; - if (qemu_savevm_state_blocked(NULL)) { + if (qemu_savevm_state_blocked(errp)) { ret = -EINVAL; goto out; } - ret = qemu_savevm_state_begin(f, ¶ms, NULL); + ret = qemu_savevm_state_begin(f, ¶ms, errp); if (ret < 0) goto out; do { - ret = qemu_savevm_state_iterate(f, NULL); + ret = qemu_savevm_state_iterate(f, errp); if (ret < 0) goto out; } while (ret == 0); - ret = qemu_savevm_state_complete(f, NULL); + ret = qemu_savevm_state_complete(f, errp); out: if (ret == 0) { ret = qemu_file_get_error(f); + if (ret < 0) { + error_setg_errno(errp, errno, "Failed to create vmstate."); + } } return ret; @@ -2187,7 +2190,7 @@ void do_savevm(Monitor *mon, const QDict *qdict) monitor_printf(mon, "Could not open VM state file\n"); goto the_end; } - ret = qemu_savevm_state(f); + ret = qemu_savevm_state(f, NULL); vm_state_size = qemu_ftell(f); qemu_fclose(f); if (ret < 0) {