Bug 861344 - usb disks ignore the address specified
usb disks ignore the address specified
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.0
Unspecified Unspecified
unspecified Severity unspecified
: rc
: 7.0
Assigned To: Gunannan Ren
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-28 05:28 EDT by Gerd Hoffmann
Modified: 2014-06-17 20:42 EDT (History)
10 users (show)

See Also:
Fixed In Version: libvirt-1.0.0-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-13 05:42:48 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Gerd Hoffmann 2012-09-28 05:28:15 EDT
Description of problem:

    <disk type='file' device='disk'>
      [ ... ]
      <target dev='sda' bus='usb'/>
      <address type='usb' bus='0' port='2.4'/>
    </disk>

libvirt happily accepts the usb address but then ignores it
when generating the qemu command line.

Version-Release number of selected component (if applicable):
libvirt-0.10.2-1.el6.x86_64
Comment 2 Gunannan Ren 2012-09-29 02:15:49 EDT
libvirt ignored the parsing of <address> element when the bus of disk is usb.
Comment 3 Dave Allan 2012-10-30 12:03:55 EDT
See also Fedora BZ 861309
Comment 4 Gunannan Ren 2012-11-06 01:57:01 EST
The bug has been fixed upstream
commit 8f708761c0d0e4eaf36bcb274d4f49fc3e0c3874
Author: Vladislav Bogdanov <bubble@hoster-ok.com>
Date:   Fri Oct 26 09:09:21 2012 +0000

    qemu: Do not ignore address for USB disks

How to test:
Add usb controller:
    <controller type='usb' index='0' model='piix3-uhci'/>
Add usb disk:
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/seconddisk'/>
      <target dev='sdb' bus='usb'/>
      <address type='usb' bus='0' port='2'/>
    </disk>

then start the guest, checking on the qemu command line.
-drive file=/var/lib/libvirt/images/seconddisk,if=none,id=drive-usb-disk1,format=raw 
-device usb-storage,bus=usb.0,port=2,drive=drive-usb-disk1,id=usb-disk1

note
Before fixing, there is no "bus=usb.0,port=2" option on the qemu command line
like:
-device usb-storage,drive=drive-usb-disk1,id=usb-disk1
Comment 5 weizhang 2012-12-17 06:23:09 EST
I test on libvirt-1.0.0-1.el7.x86_64
with 
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/disk.img'/>
      <target dev='sda' bus='usb'/>
      <address type='usb' bus='0' port='1'/>
    </disk>
    <controller type='usb' index='0' model='piix3-uhci'>
    </controller>
guest can be started successfully with qemu-kvm command line
-device usb-storage,bus=usb.0,port=1,drive=drive-usb-disk0,id=usb-disk0

But if I change the bus to 1 and try to get clear error messages, it report
error: Failed to start domain guest
error: Unable to read from monitor: Connection reset by peer

I think it should report the clear error messages here.
Comment 6 Gunannan Ren 2012-12-23 04:18:12 EST
I tested it on upstream
It reported error like the following, it was a little urgly, but it indeed printed out something useful. I can't reproduce the issue in comment 5.
Later I will send a patch to make the error more beautiful.

# virsh start rhel6qcow2
error: Failed to start domain rhel6qcow2
error: internal error process exited while connecting to monitor: do_spice_init: starting 0.10.1
spice_server_add_interface: SPICE_INTERFACE_QXL
red_worker_main: begin
display_channel_create: create display channel
cursor_channel_create: create cursor channel
qemu-kvm: -device usb-storage,bus=usb1.0,port=1,drive=drive-usb-disk0,id=usb-disk0: Bus 'usb1.0' not found
Comment 7 weizhang 2012-12-24 21:38:11 EST
(In reply to comment #6)
> I tested it on upstream
> It reported error like the following, it was a little urgly, but it indeed
> printed out something useful. I can't reproduce the issue in comment 5.
> Later I will send a patch to make the error more beautiful.
> 
I test on tree RHEL-7.0-20121217.0, please try with rhel7 tree but not upstream
Comment 9 Shanzhi Yu 2013-06-20 02:02:17 EDT
verify this bug with libvirt-1.0.6-1.el7.x86_64
steps:
1. define a guest
2. Add usb controller and usb disk as below:

    <controller type='usb' index='0' model='piix3-uhci'/>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/seconddisk'/>
      <target dev='sdb' bus='usb'/>
      <address type='usb' bus='0' port='2'/>
    </disk>
3. start the guest, check the qemu command line.

-drive file=/var/lib/libvirt/images/seconddisk,if=none,id=drive-usb-disk1,format=raw -device usb-storage,bus=usb.0,port=2,drive=drive-usb-disk1,id=usb-disk1

there is  "bus=usb.0,port=2" option, so verify this bug. for issue in comment 5, it should be another problem.
Comment 10 chhu 2014-03-04 00:36:06 EST
Test with libvirt-1.1.1-23.el7.x86_64, qemu-kvm-1.5.3-47.el7.x86_64

For the issue in comment 5, the error message is modified:

#virsh edit r7
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/images/disk.img'/>
<target dev='sdb' bus='usb'/>
<address type='usb' bus='1' port='1'/>
</disk>
<controller type='usb' index='0' model='piix3-uhci'>
</controller>

#virsh start r7
error: Failed to start domain r7
error: internal error: early end of file from monitor: possible problem:
qemu-kvm: -device usb-storage,bus=usb1.0,port=1,drive=drive-usb-disk1,id=usb-disk1: Bus 'usb1.0' not found
Comment 11 Ludek Smid 2014-06-13 05:42:48 EDT
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.

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