From patchwork Thu Oct 11 21:27:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 191004 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 152E52C0040 for ; Fri, 12 Oct 2012 08:27:36 +1100 (EST) Received: from localhost ([::1]:35240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMQI2-0002K4-6x for incoming@patchwork.ozlabs.org; Thu, 11 Oct 2012 17:27:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMQGu-0007s8-SX for qemu-devel@nongnu.org; Thu, 11 Oct 2012 17:26:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TMQGt-0005cd-Lx for qemu-devel@nongnu.org; Thu, 11 Oct 2012 17:26:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TMQGt-0005c6-Cg for qemu-devel@nongnu.org; Thu, 11 Oct 2012 17:26:23 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9BLQMSM018619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 11 Oct 2012 17:26:22 -0400 Received: from localhost (ovpn-113-113.phx2.redhat.com [10.3.113.113]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9BLQLtS012085; Thu, 11 Oct 2012 17:26:22 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 11 Oct 2012 18:27:04 -0300 Message-Id: <1349990825-2659-7-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1349990825-2659-1-git-send-email-lcapitulino@redhat.com> References: <1349990825-2659-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, armbru@redhat.com Subject: [Qemu-devel] [RFC 6/7] qmp: qmp_transaction(): pass Error object to bdrv_img_create() 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: Luiz Capitulino --- blockdev.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/blockdev.c b/blockdev.c index 01be90f..af02480 100644 --- a/blockdev.c +++ b/blockdev.c @@ -701,6 +701,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) int ret = 0; BlockdevActionList *dev_entry = dev_list; BlkTransactionStates *states, *next; + Error *local_err = NULL; QSIMPLEQ_HEAD(snap_bdrv_states, BlkTransactionStates) snap_bdrv_states; QSIMPLEQ_INIT(&snap_bdrv_states); @@ -780,12 +781,12 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) /* create new image w/backing file */ if (mode != NEW_IMAGE_MODE_EXISTING) { - ret = bdrv_img_create(new_image_file, format, - states->old_bs->filename, - states->old_bs->drv->format_name, - NULL, -1, flags, NULL, NULL); - if (ret) { - error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); + bdrv_img_create(new_image_file, format, + states->old_bs->filename, + states->old_bs->drv->format_name, + NULL, -1, flags, NULL, &local_err); + if (error_is_set(&local_err)) { + error_propagate(errp, local_err); goto delete_and_fail; } }