RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 861344 - usb disks ignore the address specified
Summary: usb disks ignore the address specified
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 7.0
Assignee: Gunannan Ren
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-28 09:28 UTC by Gerd Hoffmann
Modified: 2014-06-18 00:42 UTC (History)
10 users (show)

Fixed In Version: libvirt-1.0.0-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 09:42:48 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Gerd Hoffmann 2012-09-28 09:28:15 UTC
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 06:15:49 UTC
libvirt ignored the parsing of <address> element when the bus of disk is usb.

Comment 3 Dave Allan 2012-10-30 16:03:55 UTC
See also Fedora BZ 861309

Comment 4 Gunannan Ren 2012-11-06 06:57:01 UTC
The bug has been fixed upstream
commit 8f708761c0d0e4eaf36bcb274d4f49fc3e0c3874
Author: Vladislav Bogdanov <bubble>
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 11:23:09 UTC
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 09:18:12 UTC
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-25 02:38:11 UTC
(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 06:02:17 UTC
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 05:36:06 UTC
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 09:42:48 UTC
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.