Description of problem:
Boot guest with a data disk,then remove this data disk.Reboot guest or rescan scsi bus in guest, qemu will report "block I/O error in device '': No medium found (123)"
Version-Release number of selected component (if applicable):
# uname -r;rpm -q qemu-kvm
2.6.32-250.el6.x86_64
qemu-kvm-0.12.1.2-2.241.el6.x86_64
How reproducible:
100%
Steps to Reproduce:
1.boot guest with a data disk
/usr/libexec/qemu-kvm -M rhel6.3.0 -enable-kvm -name RHEL-Server-6.3-64 -smp 2 -m 4G -uuid 4bbfae8f-0d08-41ad-926a-c7a7568d50f7 -boot menu=on -drive file=/home/rhel6.3-64.raw,if=none,id=drive-virtio-disk0,format=raw,cache=none,media=disk,werror=stop,rerror=stop -device virtio-scsi-pci,id=virtio-scsi-pci0,bus=pci.0,addr=0x5 -device scsi-hd,drive=drive-virtio-disk0,logical_block_size=512,physical_block_size=4096,scsi-id=0,lun=0,bootindex=1 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=net0,mac=44:37:E6:5E:A3:F2,bus=pci.0,addr=0x4,id=net0 -vnc :1 -balloon none -monitor stdio -usb -usbdevice tablet -drive file=/home/test.raw,if=none,id=testdisk -device virtio-scsi-pci,id=databus -device scsi-hd,drive=testdisk,scsi-id=0,lun=1
2.remove the data disk
(qemu) __com.redhat_drive_del testdisk
3.reboot guest or rescan scsi bus in guest
Actual results:
1.qemu report block I/O error:
(qemu) block I/O error in device '': No medium found (123)
block I/O error in device '': No medium found (123)
block I/O error in device '': No medium found (123)
block I/O error in device '': No medium found (123)
2.in guest
# cat /var/log/messages |grep -i error|grep sdb
Mar 13 20:10:35 localhost kernel: end_request: I/O error, dev sdb, sector 0
Mar 13 20:10:35 localhost kernel: Buffer I/O error on device sdb, logical block 0
Mar 13 20:10:35 localhost kernel: end_request: I/O error, dev sdb, sector 0
Mar 13 20:10:35 localhost kernel: Buffer I/O error on device sdb, logical block 0
Expected results:
qemu should not report error
no error in guest's /var/log/messages
Additional info:
1.Data disk on different target/controller have the same results.
2.Remove controller(virtio-scsi-pci) no this issue.
(qemu) device_del databus
This is not a bug, the same happens if you do drive_del with an IDE or even virtio disk for example. You also need to do device_del on the scsi-hd device.
Please test that libvirt does unplug correctly, however.
"-device scsi-hd,drive=testdisk,scsi-id=0,lun=1" also should have a ID like "-device scsi-hd,drive=testdisk,scsi-id=0,lun=1,id=datadisk",then can use device_del to delete scsi-hd device.
Thanks Paolo.