]> Git Repo - qemu.git/commitdiff
scsi: Improve error reporting for invalid drive property
authorMarkus Armbruster <[email protected]>
Mon, 9 Mar 2015 18:17:27 +0000 (19:17 +0100)
committerPaolo Bonzini <[email protected]>
Tue, 10 Mar 2015 10:18:23 +0000 (11:18 +0100)
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 <[email protected]>
Reviewed-by: Peter Crosthwaite <[email protected]>
Message-Id: <1425925048[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
hw/scsi/scsi-bus.c

index 61c595fbfa75c9d42dfdd6449f27a90160485997..bd2c0e4caa6aea0149533e3685ca6c44840bcba4 100644 (file)
@@ -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;
     }
This page took 0.029011 seconds and 4 git commands to generate.