mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
virtio-blk-dataplane: Improve error reporting
Return an Error so that it can be propagated later. Tested-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> [AF: Rebased] Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
06a1307379
commit
3ffeeef735
3 changed files with 32 additions and 18 deletions
|
@ -657,6 +657,7 @@ static void virtio_blk_migration_state_changed(Notifier *notifier, void *data)
|
|||
VirtIOBlock *s = container_of(notifier, VirtIOBlock,
|
||||
migration_state_notifier);
|
||||
MigrationState *mig = data;
|
||||
Error *err = NULL;
|
||||
|
||||
if (migration_in_setup(mig)) {
|
||||
if (!s->dataplane) {
|
||||
|
@ -671,7 +672,11 @@ static void virtio_blk_migration_state_changed(Notifier *notifier, void *data)
|
|||
}
|
||||
bdrv_drain_all(); /* complete in-flight non-dataplane requests */
|
||||
virtio_blk_data_plane_create(VIRTIO_DEVICE(s), &s->blk,
|
||||
&s->dataplane);
|
||||
&s->dataplane, &err);
|
||||
if (err != NULL) {
|
||||
error_report("%s", error_get_pretty(err));
|
||||
error_free(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_VIRTIO_BLK_DATA_PLANE */
|
||||
|
@ -681,6 +686,9 @@ static int virtio_blk_device_init(VirtIODevice *vdev)
|
|||
DeviceState *qdev = DEVICE(vdev);
|
||||
VirtIOBlock *s = VIRTIO_BLK(vdev);
|
||||
VirtIOBlkConf *blk = &(s->blk);
|
||||
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
|
||||
Error *err = NULL;
|
||||
#endif
|
||||
static int virtio_blk_id;
|
||||
|
||||
if (!blk->conf.bs) {
|
||||
|
@ -708,7 +716,10 @@ static int virtio_blk_device_init(VirtIODevice *vdev)
|
|||
|
||||
s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output);
|
||||
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
|
||||
if (!virtio_blk_data_plane_create(vdev, blk, &s->dataplane)) {
|
||||
virtio_blk_data_plane_create(vdev, blk, &s->dataplane, &err);
|
||||
if (err != NULL) {
|
||||
error_report("%s", error_get_pretty(err));
|
||||
error_free(err);
|
||||
virtio_cleanup(vdev);
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue