Message ID | 1411045101-11424-1-git-send-email-arei.gonglei@huawei.com |
---|---|
State | New |
Headers | show |
On 09/18/2014 06:58 AM, arei.gonglei@huawei.com wrote: > From: Gonglei <arei.gonglei@huawei.com> s/lossing/losing/ in the subject (still) > > When scsi_bus_legacy_add_drive() produces an error, > we will lose the error message. Using error_report > to report it. > > Cc: Markus Armbruster <armbru@redhat.com> > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > Reviewed-by: Markus Armbruster <armbru@redhat.com> > Reviewed-by: Eric Blake <eblake@redhat.com> > --- > v3: > fix some typos/grammar issues (Eric) and add 'R-by' tag some but not all :) But I'm okay keeping my R-by.
> From: Eric Blake [mailto:eblake@redhat.com] > Sent: Thursday, September 18, 2014 9:01 PM > Subject: Re: [PATCH v3] pci-hotplug-old: avoid lossing error message > > On 09/18/2014 06:58 AM, arei.gonglei@huawei.com wrote: > > From: Gonglei <arei.gonglei@huawei.com> > > s/lossing/losing/ in the subject (still) > > > > > When scsi_bus_legacy_add_drive() produces an error, > > we will lose the error message. Using error_report > > to report it. > > > > Cc: Markus Armbruster <armbru@redhat.com> > > Signed-off-by: Gonglei <arei.gonglei@huawei.com> > > Reviewed-by: Markus Armbruster <armbru@redhat.com> > > Reviewed-by: Eric Blake <eblake@redhat.com> > > --- > > v3: > > fix some typos/grammar issues (Eric) and add 'R-by' tag > > some but not all :) But I'm okay keeping my R-by. > Sorry, my fault. :( v4 will fix it. Thanks! Best regards, -Gonglei > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org
diff --git a/hw/pci/pci-hotplug-old.c b/hw/pci/pci-hotplug-old.c index cf2caeb..d87c469 100644 --- a/hw/pci/pci-hotplug-old.c +++ b/hw/pci/pci-hotplug-old.c @@ -107,6 +107,7 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter, { SCSIBus *scsibus; SCSIDevice *scsidev; + Error *local_err = NULL; scsibus = (SCSIBus *) object_dynamic_cast(OBJECT(QLIST_FIRST(&adapter->child_bus)), @@ -127,8 +128,10 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter, dinfo->unit = qemu_opt_get_number(dinfo->opts, "unit", -1); dinfo->bus = scsibus->busnr; scsidev = scsi_bus_legacy_add_drive(scsibus, dinfo->bdrv, dinfo->unit, - false, -1, NULL, NULL); + false, -1, NULL, &local_err); if (!scsidev) { + error_report("%s", error_get_pretty(local_err)); + error_free(local_err); return -1; } dinfo->unit = scsidev->id;