Bug 1139572

Summary: fail to hot-unplug virtio-blk dataplane via __com.redhat_drive_del/device_del command
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvm-rhevAssignee: Stefan Hajnoczi <stefanha>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: chayang, famz, hhuang, juzhang, michen, pbonzini, qzhang, rbalakri, stefanha, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-11 14:18:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sibiao Luo 2014-09-09 08:43:24 UTC
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"}}

Comment 1 Stefan Hajnoczi 2014-09-11 14:18:47 UTC

*** This bug has been marked as a duplicate of bug 1136752 ***