From patchwork Thu Dec 13 15:40:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Hrdina X-Patchwork-Id: 206129 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 840F92C0091 for ; Fri, 14 Dec 2012 02:43:04 +1100 (EST) Received: from localhost ([::1]:52899 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAwA-0004kk-OP for incoming@patchwork.ozlabs.org; Thu, 13 Dec 2012 10:43:02 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAuR-0001gw-A7 for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:41:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjAuH-0005uZ-9i for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:41:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:65208) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAuH-0005uP-1w for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:41:05 -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 qBDFf48C028375 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 13 Dec 2012 10:41:04 -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 qBDFeqvN030229; Thu, 13 Dec 2012 10:41:03 -0500 From: Pavel Hrdina To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2012 16:40:44 +0100 Message-Id: <89c02dfa57bce0807035bbf9cb6d0e633639bf32.1355404685.git.phrdina@redhat.com> 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 10/17] savevm: add error parameter to qemu_savevm_state_complete() 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 | 13 ++++++++++--- sysemu.h | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/migration.c b/migration.c index bbc0cac..3ae1db0 100644 --- a/migration.c +++ b/migration.c @@ -353,7 +353,7 @@ void migrate_fd_put_ready(MigrationState *s) qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER); vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); - if (qemu_savevm_state_complete(s->file) < 0) { + if (qemu_savevm_state_complete(s->file, NULL) < 0) { migrate_fd_error(s); } else { migrate_fd_completed(s); diff --git a/savevm.c b/savevm.c index 26f12e1..c17cc7f 100644 --- a/savevm.c +++ b/savevm.c @@ -1713,7 +1713,8 @@ int qemu_savevm_state_iterate(QEMUFile *f, return ret; } -int qemu_savevm_state_complete(QEMUFile *f) +int qemu_savevm_state_complete(QEMUFile *f, + Error **errp) { SaveStateEntry *se; int ret; @@ -1737,6 +1738,7 @@ int qemu_savevm_state_complete(QEMUFile *f) ret = se->ops->save_live_complete(f, se->opaque); trace_savevm_section_end(se->section_id); if (ret < 0) { + error_setg(errp, "Failed to complete vmstate save."); return ret; } } @@ -1766,7 +1768,12 @@ int qemu_savevm_state_complete(QEMUFile *f) qemu_put_byte(f, QEMU_VM_EOF); - return qemu_file_get_error(f); + ret = qemu_file_get_error(f); + if (ret < 0) { + error_setg(errp, "%s", strerror(errno)); + } + + return ret; } void qemu_savevm_state_cancel(QEMUFile *f) @@ -1803,7 +1810,7 @@ static int qemu_savevm_state(QEMUFile *f) goto out; } while (ret == 0); - ret = qemu_savevm_state_complete(f); + ret = qemu_savevm_state_complete(f, NULL); out: if (ret == 0) { diff --git a/sysemu.h b/sysemu.h index d0530b2..11a4560 100644 --- a/sysemu.h +++ b/sysemu.h @@ -78,7 +78,8 @@ int qemu_savevm_state_begin(QEMUFile *f, Error **errp); int qemu_savevm_state_iterate(QEMUFile *f, Error **errp); -int qemu_savevm_state_complete(QEMUFile *f); +int qemu_savevm_state_complete(QEMUFile *f, + Error **errp); void qemu_savevm_state_cancel(QEMUFile *f); int qemu_loadvm_state(QEMUFile *f);