From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
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
Date: Mon, 9 Mar 2015 19:17:27 +0100 [thread overview]
Message-ID: <1425925048-15482-4-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1425925048-15482-1-git-send-email-armbru@redhat.com>
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 <armbru@redhat.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
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;
}
--
1.9.3
next prev parent reply other threads:[~2015-03-09 18:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-09 18:17 [Qemu-devel] [PATCH v2 0/4] scsi: Error reporting cleanups, realize() Markus Armbruster
2015-03-09 18:17 ` [Qemu-devel] [PATCH v2 1/4] scsi: Clean up duplicated error in legacy if=scsi code Markus Armbruster
2015-03-09 18:17 ` [Qemu-devel] [PATCH v2 2/4] hw: Propagate errors through qdev_prop_set_drive() Markus Armbruster
2015-03-09 18:17 ` Markus Armbruster [this message]
2015-03-09 18:17 ` [Qemu-devel] [PATCH v2 4/4] scsi: Convert remaining PCI HBAs to realize() Markus Armbruster
2015-03-09 19:22 ` [Qemu-devel] [PATCH v2 0/4] scsi: Error reporting cleanups, realize() Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425925048-15482-4-git-send-email-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=hare@suse.de \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).