[kolla-ansible][all][nova][zed][latest] USB passthrough / Hot-plug / Cold-plug

Modyngs mobilebackup95 at gmail.com
Sun Apr 30 10:04:18 UTC 2023


090c090cFolks,

A USB device (not necessarily a mass/Flash drive) needs to be connected to
one of the VMs (an openstack instance).

Openstack installed with kolla-ansible{Latest version/ Also tested on Zed}
ALL IN ONE Deployments on ubuntu server 22.04 ( Core i9 12900K).

I found the [nova-libvirt] container which contains *virsh *and is able to
edit it or use custom config for VMs.

I've gone through lots of the docs, to name a few:
https://libvirt.org/formatdomain.html
https://wiki.openstack.org/wiki/Nova/USB_device_hot_cold_plug
https://wiki.openstack.org/wiki/Nova/proposal_about_usb_passthrough
https://documentation.suse.com/sles/15-SP1/html/SLES-all/cha-libvirt-config-virsh.html
https://wiki.openstack.org/wiki/Nova/USB_device_hot_cold_plug
https://docs.nxp.com/bundle/GUID-487B2E69-BB19-42CB-AC38-7EF18C0FE3AE/page/GUID-A658B311-CE08-4496-9491-1F00687EC4AE.html

but none of them worked for me!!

To reproduce:

*Cold-Plug :*
*$ lsusb  (on host)*
Bus 001 Device 014: ID 090c:1000 Silicon Motion >>>> Note Device number
changed every time I disconnect the device. So it might be different in the
changed attempt shown below)

*$ docker exec -it nova_libvirt /bin/bash*
*%Turn the Desired VM off*
*# virsh list --all*
 Id   Name                State
---------------------------------------------
 2    instance-00000002   running
19   instance-00000008   running
  -    instance-0000000a   shut off
*# virsh edit instance-0000000a*
                    Add the changes [1][2][3][4],... ( many efforts have
been done but few samples of them are)
[1]: under <devices> added

<hostdev mode='subsystem' type='usb'>
  <source>
    <vendor id='0x090c'/>
    <product id='0x1000'/>
  </source>
</hostdev>

[2]:under <devices> added

  <controller type='usb' index='0'/>
  <hostdev mode='subsystem' type='usb'>
    <source>
      <vendor id='0x090c'/>
      <product id='0x1000'/>
    </source>
  </hostdev>

[3]: under <devices> added

<hostdev mode='subsystem' type='usb' managed='yes'>
  <source>
    <vendor id='0x090c'/>
    <product id='0x1000'/>
  </source>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
</hostdev>

[4]: under <devices> added

<controller type='usb' model='nec-xhci' index='0'/>
  <hostdev mode='subsystem' type='usb' managed='yes'>
    <source>
      <vendor id='0x090c'/>
      <product id='0x1000'/>
    </source>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
  </hostdev>

[5]:

<controller type='usb' index='0'>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<hostdev mode='subsystem' type='usb' managed='yes'>
  <source>
    <vendor id='0x090c'/>
    <product id='0x1000'/>
  </source>
  <address type='usb' bus='1' port='2'/>
  <controller type='usb' index='0'/>
</hostdev>


*%Start the VM*
*expected behavior:*
          when login to the VM, lsusb or df -h shows the USB
*what happened:*
          it wont show the USB from the VM

*OR *virsh dumpxml instance-0000000a > instance-0000000a.xml
and then change the configs as above and then

virsh attach-device instance-0000000a --file
/path/to/updated-instance-0000000a.xml --config


*Hot-Plug :*
*$ lsusb  (on host)*
Bus 001 Device 014: ID 090c:1000 Silicon Motion >>>> Note Device number
changed every time I disconnect the device. So it might be different in the
changed attempt shown below)

*$ docker exec -it nova_libvirt /bin/bash*
*# virsh list --all*
 Id   Name                State
---------------------------------------------
 2    instance-00000002   running
19   instance-00000008   running
20   instance-0000000a   running


*#nano USB.xml*
*%add changes explained in *[1][2][3][4],...

*$ virsh attach-device  instance-0000000a   /path/to/USB.xml/file*

*expected behavior:*
          lsusb or df -h shows the USB
*what happened:*
          it wont show the USB from the VM




*Can you please guide me through this? Any recommendation would be much
appreciated!Any custom changes comes to your mind ( Reply it) would be
solution for this problem /;*
Thanks
Best regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.openstack.org/pipermail/openstack-discuss/attachments/20230430/70d01d72/attachment.htm>


More information about the openstack-discuss mailing list