Description of problem:
Launch a KVM guest with a virtio-blk dataplane data disk, then do hotunplug it via __com.redhat_drive_del before device_del command, but it fail to unplug it successfully.
BTW, if disable the dataplane to do the same test which cann't hit this issue.
Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm-rhev
3.10.0-152.el7.x86_64
qemu-kvm-rhev-2.1.0-3.el7.x86_64
guest info:
3.10.0-152.el7.x86_64
How reproducible:
100%
Steps to Reproduce:
1.launch a KVM guest with a virtio-blk dataplane data disk.
e.g:...-object iothread,id=iothread0 -drive file=/home/my-data-disk.qcow2,if=none,id=drive-data-disk0,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop -device virtio-blk-pci,drive=drive-data-disk0,id=data-disk0,iothread=iothread0,bus=pci.0,addr=0x7
2.do hotunplug it via __com.redhat_drive_del before device_del command.
3.run device_del command directly.
Actual results:
after step 2, it fail hot-unplug the virtio-blk dataplane data disk, and fail to give a coorectly error prompt via QMP while it prompt a " block device is in use by data plane" in HMP monitor.
{"execute":"__com.redhat_drive_del","arguments":{"id":"drive-data-disk0"}}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(qemu) Device 'drive-data-disk0' is busy: block device is in use by data plane
after step 3, it can hot-unplug the virtio-blk dataplane data disk successfully.
{"execute":"device_del","arguments":{"id":"data-disk0"}}
{"return": {}}
{"timestamp": {"seconds": 1410251110, "microseconds": 449966}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/data-disk0/virtio-backend"}}
{"timestamp": {"seconds": 1410251110, "microseconds": 452201}, "event": "DEVICE_DELETED", "data": {"device": "data-disk0", "path": "/machine/peripheral/data-disk0"}}
Expected results:
1.If virtio-blk dataplane support to hotunplug via __com.redhat_drive_del/device_del, we should fix it to work.
2.If virtio-blk dataplane not support it, QMP should give a correct error info prompt, like HMP.
(qemu) drive_del drive-data-disk0
Device 'drive-data-disk0' is busy: block device is in use by data plane
{"execute":"__com.redhat_drive_del","arguments":{"id":"drive-data-disk0"}}
{"error": {"class": "GenericError", "desc": "An undefined error has occurred"}}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
block device is in use by data plane
Additional info:
Also tried the virtio-blk data disk without data-plane enable which did not hit it.
e.g:...-drive file=/home/my-data-disk.qcow2,if=none,id=drive-data-disk0,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop -device virtio-blk-pci,drive=drive-data-disk0,id=data-disk0,bus=pci.0,addr=0x7
{"execute":"qmp_capabilities"}
{"return": {}}
{"execute":"__com.redhat_drive_del","arguments":{"id":"drive-data-disk0"}}
{"return": {}}
{"execute":"device_del","arguments":{"id":"data-disk0"}}
{"return": {}}
{"timestamp": {"seconds": 1410251193, "microseconds": 52349}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/data-disk0/virtio-backend"}}
{"timestamp": {"seconds": 1410251193, "microseconds": 52455}, "event": "DEVICE_DELETED", "data": {"device": "data-disk0", "path": "/machine/peripheral/data-disk0"}}