From patchwork Mon Mar 9 18:17:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 448161 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 D00DA14010F for ; Tue, 10 Mar 2015 05:18:08 +1100 (AEDT) Received: from localhost ([::1]:44652 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YV2Fh-0001hg-1i for incoming@patchwork.ozlabs.org; Mon, 09 Mar 2015 14:18:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YV2FF-0000zp-8N for qemu-devel@nongnu.org; Mon, 09 Mar 2015 14:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YV2FA-0004wq-8c for qemu-devel@nongnu.org; Mon, 09 Mar 2015 14:17:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YV2F9-0004wf-W7 for qemu-devel@nongnu.org; Mon, 09 Mar 2015 14:17:32 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t29IHVfP014877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 9 Mar 2015 14:17:31 -0400 Received: from blackfin.pond.sub.org (ovpn-116-56.ams2.redhat.com [10.36.116.56]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t29IHT07003587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 9 Mar 2015 14:17:30 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D4840305E2DE; Mon, 9 Mar 2015 19:17:28 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Mon, 9 Mar 2015 19:17:27 +0100 Message-Id: <1425925048-15482-4-git-send-email-armbru@redhat.com> In-Reply-To: <1425925048-15482-1-git-send-email-armbru@redhat.com> References: <1425925048-15482-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, peter.crosthwaite@xilinx.com, hare@suse.de Subject: [Qemu-devel] [PATCH v2 3/4] scsi: Improve error reporting for invalid drive property 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 When setting "realized" fails, scsi_bus_legacy_add_drive() passes the error to qerror_report_err(), then returns an unspecific "Setting drive property failed" error, which is reported further up the call chain. Example: $ qemu-system-x86_64 -nodefaults -S -display none \ > -drive if=scsi,id=foo,file=tmp.qcow2 -global isa-fdc.driveA=foo qemu-system-x86_64: -drive if=scsi,id=foo,file=tmp.qcow2: Property 'scsi-disk.drive' can't take value 'foo', it's in use qemu-system-x86_64: Setting drive property failed qemu-system-x86_64: Initialization of device lsi53c895a failed: Device initialization failed Clean up the obvious way: simply return the original error to the caller. Gets rid of the second message in the above error cascade. Signed-off-by: Markus Armbruster Reviewed-by: Peter Crosthwaite --- hw/scsi/scsi-bus.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 61c595f..bd2c0e4 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -7,7 +7,6 @@ #include "sysemu/blockdev.h" #include "trace.h" #include "sysemu/dma.h" -#include "qapi/qmp/qerror.h" static char *scsibus_get_dev_path(DeviceState *dev); static char *scsibus_get_fw_dev_path(DeviceState *dev); @@ -245,9 +244,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockBackend *blk, } qdev_prop_set_drive(dev, "drive", blk, &err); if (err) { - qerror_report_err(err); - error_free(err); - error_setg(errp, "Setting drive property failed"); + error_propagate(errp, err); object_unparent(OBJECT(dev)); return NULL; }