]> git.proxmox.com Git - mirror_qemu.git/commitdiff
dataplane: bail out on unsupported transport
authorCornelia Huck <cornelia.huck@de.ibm.com>
Wed, 18 Jun 2014 09:58:30 +0000 (17:58 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 1 Jul 2014 07:15:02 +0000 (09:15 +0200)
If the virtio transport does not support notifiers (like s390-virtio),
we can't use dataplane. Bail out early and let the user know what is
wrong.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/block/dataplane/virtio-blk.c

index 09bd2c70ab515d2f5a16665345d171376809c8d9..f6e1a5d919fba98a8c8967bbcc41e69ef82864e4 100644 (file)
@@ -127,6 +127,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
     VirtIOBlockDataPlane *s;
     VirtIOBlock *vblk = VIRTIO_BLK(vdev);
     Error *local_err = NULL;
+    BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
+    VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
 
     *dataplane = NULL;
 
@@ -134,6 +136,14 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk,
         return;
     }
 
+    /* Don't try if transport does not support notifiers. */
+    if (!k->set_guest_notifiers || !k->set_host_notifier) {
+        error_setg(errp,
+                   "device is incompatible with x-data-plane "
+                   "(transport does not support notifiers)");
+        return;
+    }
+
     /* If dataplane is (re-)enabled while the guest is running there could be
      * block jobs that can conflict.
      */