From patchwork Thu Dec 13 15:40:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Hrdina X-Patchwork-Id: 206151 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 285AB2C008E for ; Fri, 14 Dec 2012 03:23:03 +1100 (EST) Received: from localhost ([::1]:49033 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAuu-0002ef-Vp for incoming@patchwork.ozlabs.org; Thu, 13 Dec 2012 10:41:44 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAuL-0001Ov-3Q for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:41:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjAuG-0005uC-9I for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:41:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4393) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAuF-0005tv-VR for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:41:04 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBDFf37n023240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 13 Dec 2012 10:41:03 -0500 Received: from localhost.localdomain.com (dhcp-27-184.brq.redhat.com [10.34.27.184]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBDFeqvM030229; Thu, 13 Dec 2012 10:41:02 -0500 From: Pavel Hrdina To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2012 16:40:43 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: phrdina@redhat.com Subject: [Qemu-devel] [PATCH v2 09/17] savevm: add error parameter to qemu_savevm_state_iterate() 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 --- migration.c | 2 +- savevm.c | 11 +++++++++-- sysemu.h | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/migration.c b/migration.c index bf51a07..bbc0cac 100644 --- a/migration.c +++ b/migration.c @@ -341,7 +341,7 @@ void migrate_fd_put_ready(MigrationState *s) } DPRINTF("iterate\n"); - ret = qemu_savevm_state_iterate(s->file); + ret = qemu_savevm_state_iterate(s->file, NULL); if (ret < 0) { migrate_fd_error(s); } else if (ret == 1) { diff --git a/savevm.c b/savevm.c index 633a697..26f12e1 100644 --- a/savevm.c +++ b/savevm.c @@ -1663,7 +1663,8 @@ int qemu_savevm_state_begin(QEMUFile *f, * 0 : We haven't finished, caller have to go again * 1 : We have finished, we can go to complete phase */ -int qemu_savevm_state_iterate(QEMUFile *f) +int qemu_savevm_state_iterate(QEMUFile *f, + Error **errp) { SaveStateEntry *se; int ret = 1; @@ -1697,10 +1698,16 @@ int qemu_savevm_state_iterate(QEMUFile *f) } } if (ret != 0) { + if (ret < 0) { + error_setg(errp, "Failed to iterate vmstate save."); + } return ret; } ret = qemu_file_get_error(f); if (ret != 0) { + if (ret < 0) { + error_setg(errp, "%s", strerror(errno)); + } qemu_savevm_state_cancel(f); } return ret; @@ -1791,7 +1798,7 @@ static int qemu_savevm_state(QEMUFile *f) goto out; do { - ret = qemu_savevm_state_iterate(f); + ret = qemu_savevm_state_iterate(f, NULL); if (ret < 0) goto out; } while (ret == 0); diff --git a/sysemu.h b/sysemu.h index 07c5322..d0530b2 100644 --- a/sysemu.h +++ b/sysemu.h @@ -76,7 +76,8 @@ bool qemu_savevm_state_blocked(Error **errp); int qemu_savevm_state_begin(QEMUFile *f, const MigrationParams *params, Error **errp); -int qemu_savevm_state_iterate(QEMUFile *f); +int qemu_savevm_state_iterate(QEMUFile *f, + Error **errp); int qemu_savevm_state_complete(QEMUFile *f); void qemu_savevm_state_cancel(QEMUFile *f); int qemu_loadvm_state(QEMUFile *f);