From patchwork Thu Dec 13 15:40:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Hrdina X-Patchwork-Id: 206168 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 CF75D2C00DC for ; Fri, 14 Dec 2012 03:53:02 +1100 (EST) Received: from localhost ([::1]:49022 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAus-0002eH-Eb for incoming@patchwork.ozlabs.org; Thu, 13 Dec 2012 10:41:42 -0500 Received: from eggs.gnu.org ([208.118.235.92]:47295) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAuF-00018A-GO for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:41:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TjAuE-0005tK-Gy for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:41:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:26746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TjAuE-0005t1-2o for qemu-devel@nongnu.org; Thu, 13 Dec 2012 10:41:02 -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 qBDFf1W6028345 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 13 Dec 2012 10:41:01 -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 qBDFeqvK030229; Thu, 13 Dec 2012 10:41:00 -0500 From: Pavel Hrdina To: qemu-devel@nongnu.org Date: Thu, 13 Dec 2012 16:40:41 +0100 Message-Id: <0e0b8429c8da2bc3b210d52e0e223bbf79cb5dcf.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 07/17] block: add error parameter to del_existing_snapshots() 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 | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/savevm.c b/savevm.c index 7ab7c7c..3ee7da5 100644 --- a/savevm.c +++ b/savevm.c @@ -2094,22 +2094,18 @@ static int bdrv_snapshot_find(BlockDriverState *bs, /* * Deletes snapshots of a given name in all opened images. */ -static int del_existing_snapshots(Monitor *mon, const char *name) +static int del_existing_snapshots(const char *name, + Error **errp) { BlockDriverState *bs; QEMUSnapshotInfo sn1, *snapshot = &sn1; - int ret; bs = NULL; while ((bs = bdrv_next(bs))) { if (bdrv_can_snapshot(bs) && bdrv_snapshot_find(bs, snapshot, name, NULL) >= 0) { - ret = bdrv_snapshot_delete(bs, name, NULL); - if (ret < 0) { - monitor_printf(mon, - "Error while deleting snapshot on '%s'\n", - bdrv_get_device_name(bs)); + if (bdrv_snapshot_delete(bs, name, errp) < 0) { return -1; } } @@ -2194,7 +2190,7 @@ void do_savevm(Monitor *mon, const QDict *qdict) } /* Delete old snapshots of the same name */ - if (name && del_existing_snapshots(mon, name) < 0) { + if (name && del_existing_snapshots(name, NULL) < 0) { goto the_end; }