Hide Forgot
Description of problem: hotplug USB disk device miss drive_del on failure Version-Release number of selected component (if applicable): libvirt-2.0.0-6.el7.x86_64 qemu-kvm-rhev-2.6.0-22.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. define and start a guest like following : # virsh dumpxml vm2 | grep usb <controller type='usb' index='0'> <alias name='usb'/> ...... Prepare a usb disk xml like following with special address # cat usb.xml <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/sdb'/> <target dev='sda' bus='usb'/> <address type='usb' bus='0' port='3'/> </disk> 2.Try to attach the usb disk device, it should fail to attach since the ports limitation. # virsh attach-device vm2 usb.xml error: Failed to attach device from usb.xml error: internal error: unable to execute QEMU command 'device_add': usb port 3 (bus usb.0) not found (in use?) 3. delete the address, try to attach again # cat usb.xml <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/sdb'/> <target dev='sda' bus='usb'/> </disk> # virsh attach-device vm2 usb.xml error: Failed to attach device from usb.xml error: internal error: unable to execute QEMU command '__com.redhat_drive_add': Duplicate ID 'drive-usb-disk0' for drive Actual results: As step3, it fails to attach USB deivce after a failure. Expected results: It should attach successfully. Additional info:
Upstream fixes this by: commit 190e22c06ba7e4b38e7690a7ef2ae4fc423a0b38 Author: John Ferlan <jferlan> Date: Wed Jun 29 16:32:58 2016 -0400 qemu: Add attempt to call qemuMonitorDriveDel for USB failure path Partial fix for: https://bugzilla.redhat.com/show_bug.cgi?id=1336225 Similar to the other disk types, add the qemuMonitorDriveDel in the failure to add/hotplug a USB. Added a couple of other formatting changes just to have a less cluttered look
verify the bug version: libvirt-3.0.0-1.el7.x86_64 qemu-kvm-rhev-2.8.0-3.el7.x86_64 steps: 1. define and start a guest like following : # virsh dumpxml qq | grep usb ... <controller type='usb' index='0'> <alias name='usb'/> ... Prepare a usb disk xml like following with special address # cat usb.xml <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/sda'/> <target dev='sdc' bus='usb'/> <address type='usb' bus='0' port='300'/> </disk> 2.Try to attach the usb disk device, it should fail to attach since the ports limitation. # virsh attach-device qq usb.xml error: Failed to attach device from usb.xml error: XML error: requested USB port 300 not present on USB bus 0 3. delete the address, try to attach again # cat usb.xml <disk type='block' device='disk'> <driver name='qemu' type='raw'/> <source dev='/dev/sda'/> <target dev='sdc' bus='usb'/> </disk> # virsh attach-device qq usb.xml Device attached successfully
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2017:1846