[libvirt-users] usb passtrough stuck to a given

Mauricio Tavares raubvogel at gmail.com
Wed Sep 24 21:08:31 UTC 2014


On Wed, Sep 24, 2014 at 5:00 PM, Cole Robinson <crobinso at redhat.com> wrote:
> On 09/24/2014 04:11 PM, Mauricio Tavares wrote:
>>       So I have an entry for a USB device ( ID 051d:0002, UPS) I want
>> to use with a given vm client. In that vm client's config file I added
>> something like this:
>>
>>     <hostdev mode='subsystem' type='usb' managed='yes'>
>>       <source>
>>         <vendor id='0x051d'/>
>>         <product id='0x0002'/>
>>       </source>
>>     </hostdev>
>>
>> And that worked fine for a while. Now I moved the vm host, and then
>> put the cable to the UPS on an available USB port
>>
>> Bus 002 Device 006: ID 051d:0002 American Power Conversion Uninterruptible Power
>>
>> and tried to restart the client... and got the following message:
>>
>> error: internal error Did not find USB device 51d:2 bus:2 device:3
>>
>> Er, why should it care about which bus and device this is? I thought
>> my config would mean it would look for the device that matched the ID
>> in the config no matter where it was. How did it learn and memorized
>> what I guess is the old location?
>>
>
> It needs to lookup the bus/device at VM startup time, so it can set
> permissions on the device node.
>
> Check your VM XML (not from /etc/libvirt, but from virsh dumpxml $vmname), and
> ensure that the bus/device didn't get encoded somehow.
>
      This is the output from virsh dumpxml vmclient, with client off
(can't start because of said error):

<domain type='kvm'>
  <name>vmclient</name>
  <uuid>5a4cde18-5bb7-49ab-a11a-edb305fe4a87</uuid>
  <memory unit='KiB'>524288</memory>
  <currentMemory unit='KiB'>524288</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <os>
    <type arch='x86_64' machine='rhel6.3.0'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>Westmere</model>
  </cpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source file='/dev/vmhost_vg0/vmclient'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04'
function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x2'/>
    </controller>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='c0:ff:ee:4f:96:a9'/>
      <source bridge='lanbr'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
function='0x0'/>
    </interface>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x051d'/>
        <product id='0x0002'/>
      </source>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x0'/>
    </memballoon>
  </devices>
</domain>

It must be me but I have not seen anything that is trying down that
usb device to a given bus/device. I will also check the vmhost's logs
to see if there is any funny business there.

> - Cole
>




More information about the libvirt-users mailing list