From patchwork Tue Nov 21 15:10:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 840080 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yh8F02YXzz9s71 for ; Wed, 22 Nov 2017 02:11:32 +1100 (AEDT) Received: from localhost ([::1]:34997 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHACw-0003IJ-Ab for incoming@patchwork.ozlabs.org; Tue, 21 Nov 2017 10:11:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHAC8-0003BM-EJ for qemu-devel@nongnu.org; Tue, 21 Nov 2017 10:10:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHAC7-0005HZ-FH for qemu-devel@nongnu.org; Tue, 21 Nov 2017 10:10:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44150) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eHABz-0005Al-Gg; Tue, 21 Nov 2017 10:10:31 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ADF77D56ED; Tue, 21 Nov 2017 15:10:30 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-148.ams2.redhat.com [10.36.117.148]) by smtp.corp.redhat.com (Postfix) with ESMTP id C48AB6C427; Tue, 21 Nov 2017 15:10:28 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 21 Nov 2017 16:10:14 +0100 Message-Id: <20171121151017.28158-5-kwolf@redhat.com> In-Reply-To: <20171121151017.28158-1-kwolf@redhat.com> References: <20171121151017.28158-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 21 Nov 2017 15:10:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/7] block: Add errp to bdrv_all_goto_snapshot() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Kevin Wolf Reviewed-by: Eric Blake Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: John Snow --- include/block/snapshot.h | 3 ++- block/snapshot.c | 11 ++++++----- migration/savevm.c | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/include/block/snapshot.h b/include/block/snapshot.h index aeb80405e8..9407799941 100644 --- a/include/block/snapshot.h +++ b/include/block/snapshot.h @@ -84,7 +84,8 @@ int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState *bs, bool bdrv_all_can_snapshot(BlockDriverState **first_bad_bs); int bdrv_all_delete_snapshot(const char *name, BlockDriverState **first_bsd_bs, Error **err); -int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bsd_bs); +int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_bs, + Error **errp); int bdrv_all_find_snapshot(const char *name, BlockDriverState **first_bad_bs); int bdrv_all_create_snapshot(QEMUSnapshotInfo *sn, BlockDriverState *vm_state_bs, diff --git a/block/snapshot.c b/block/snapshot.c index 75562df4cc..8585599579 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -467,9 +467,10 @@ fail: } -int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_bs) +int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_bs, + Error **errp) { - int err = 0; + int ret = 0; BlockDriverState *bs; BdrvNextIterator it; @@ -478,10 +479,10 @@ int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_bs) aio_context_acquire(ctx); if (bdrv_can_snapshot(bs)) { - err = bdrv_snapshot_goto(bs, name, NULL); + ret = bdrv_snapshot_goto(bs, name, errp); } aio_context_release(ctx); - if (err < 0) { + if (ret < 0) { bdrv_next_cleanup(&it); goto fail; } @@ -489,7 +490,7 @@ int bdrv_all_goto_snapshot(const char *name, BlockDriverState **first_bad_bs) fail: *first_bad_bs = bs; - return err; + return ret; } int bdrv_all_find_snapshot(const char *name, BlockDriverState **first_bad_bs) diff --git a/migration/savevm.c b/migration/savevm.c index 4a88228614..192f2d82cd 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -2346,10 +2346,10 @@ int load_snapshot(const char *name, Error **errp) /* Flush all IO requests so they don't interfere with the new state. */ bdrv_drain_all_begin(); - ret = bdrv_all_goto_snapshot(name, &bs); + ret = bdrv_all_goto_snapshot(name, &bs, errp); if (ret < 0) { - error_setg(errp, "Error %d while activating snapshot '%s' on '%s'", - ret, name, bdrv_get_device_name(bs)); + error_prepend(errp, "Could not load snapshot '%s' on '%s': ", + name, bdrv_get_device_name(bs)); goto err_drain; }