Bug 1372580 - hotplug USB disk device miss drive_del on failure
Summary: hotplug USB disk device miss drive_del on failure
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: lijuan men
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-02 06:30 UTC by Pei Zhang
Modified: 2017-08-02 01:27 UTC (History)
6 users (show)

Fixed In Version: libvirt-2.5.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 17:14:13 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description Pei Zhang 2016-09-02 06:30:12 UTC
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:

Comment 1 Peter Krempa 2016-09-13 08:41:43 UTC
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

Comment 3 lijuan men 2017-02-16 03:37:27 UTC
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

Comment 4 errata-xmlrpc 2017-08-01 17:14:13 UTC
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

Comment 5 errata-xmlrpc 2017-08-01 23:55:08 UTC
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

Comment 6 errata-xmlrpc 2017-08-02 01:27:35 UTC
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


Note You need to log in before you can comment on or make changes to this bug.