<div dir="ltr">090c090cFolks,<br><br><div>A USB device (not necessarily a mass/Flash drive) needs to be connected to one of the VMs (an openstack instance).</div><div><br></div><div>Openstack installed with kolla-ansible{Latest version/ Also tested on Zed} ALL IN ONE Deployments on ubuntu server 22.04 ( Core i9 12900K).<br><br>I found the [nova-libvirt] container which contains <b>virsh </b>and is able to edit it or use custom config for VMs.<br><br>I've gone through lots of the docs, to name a few:</div><div><font size="1"><a href="https://libvirt.org/formatdomain.html">https://libvirt.org/formatdomain.html</a></font></div><div><font size="1"><a href="https://wiki.openstack.org/wiki/Nova/USB_device_hot_cold_plug">https://wiki.openstack.org/wiki/Nova/USB_device_hot_cold_plug</a><br></font></div><div><font size="1"><a href="https://wiki.openstack.org/wiki/Nova/proposal_about_usb_passthrough">https://wiki.openstack.org/wiki/Nova/proposal_about_usb_passthrough</a><br></font></div><div><font size="1"><a href="https://documentation.suse.com/sles/15-SP1/html/SLES-all/cha-libvirt-config-virsh.html">https://documentation.suse.com/sles/15-SP1/html/SLES-all/cha-libvirt-config-virsh.html</a><br></font></div><div><font size="1"><a href="https://wiki.openstack.org/wiki/Nova/USB_device_hot_cold_plug">https://wiki.openstack.org/wiki/Nova/USB_device_hot_cold_plug</a><br></font></div><div><font size="1"><a href="https://docs.nxp.com/bundle/GUID-487B2E69-BB19-42CB-AC38-7EF18C0FE3AE/page/GUID-A658B311-CE08-4496-9491-1F00687EC4AE.html">https://docs.nxp.com/bundle/GUID-487B2E69-BB19-42CB-AC38-7EF18C0FE3AE/page/GUID-A658B311-CE08-4496-9491-1F00687EC4AE.html</a></font><br></div><div><br></div><div>but none of them worked for me!!<br><br>To reproduce:</div><div><br></div><div><b><i><u><font size="6">Cold-Plug :</font></u></i></b><br><div style="text-align:center"><i><b>$ lsusb  (on host)</b></i></div></div><div style="text-align:left">Bus 001 Device 0<span style="background-color:rgb(255,0,255)">14</span>: ID 090c:1000 Silicon Motion <font size="1">>>>> Note Device number changed every time I disconnect the device. So it might be different in the changed attempt shown below)</font></div><div style="text-align:center"><br></div><div><div style="text-align:center"><i><b>$ docker exec -it nova_libvirt /bin/bash</b></i></div><div style="text-align:center"><b>%Turn the Desired VM off</b></div><div style="text-align:center"><i><b># virsh list --all</b></i></div> Id   Name                State<br>---------------------------------------------<br> 2    instance-00000002   running</div><div>19   instance-00000008   running</div><div>  -    instance-0000000a   shut off<br><div style="text-align:center"><b># virsh edit instance-0000000a</b></div></div><div>                    Add the changes [1][2][3][4],... <font size="1">( many efforts have been done but few samples of them are)</font></div><div>[1]: under <devices> added</div><div><pre class="gmail-MarkdownCodeBlock_preTag__dDgT9" style="margin-top:0px;margin-bottom:0px;font-size:14px;padding:0.5em;background:rgb(43,43,43);overflow-x:auto;color:rgb(248,248,242)"><code class="gmail-MarkdownCodeBlock_codeTag__ipdCC" style="background-color:transparent;padding:0px;font-family:Consolas,monaco,monospace;word-break:break-all"><hostdev <span style="color:rgb(255,215,0)">mode</span>=<span style="color:rgb(171,227,56)">'subsystem'</span> <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span>>
  <source>
    <vendor <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x</span>090c<span style="color:rgb(171,227,56)">'</span>/>
    <product <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x</span>1000<span style="color:rgb(171,227,56)">'</span>/>
  </source>
</hostdev></code></pre></div><div>[2]:under <devices> added</div><div><pre class="gmail-MarkdownCodeBlock_preTag__dDgT9" style="margin-top:0px;margin-bottom:0px;font-size:14px;padding:0.5em;background:rgb(43,43,43);overflow-x:auto;color:rgb(248,248,242)"><code class="gmail-MarkdownCodeBlock_codeTag__ipdCC" style="background-color:transparent;padding:0px;font-family:Consolas,monaco,monospace;word-break:break-all">  <controller <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span> <span style="color:rgb(255,215,0)">index</span>=<span style="color:rgb(171,227,56)">'0'</span>/>
  <hostdev <span style="color:rgb(255,215,0)">mode</span>=<span style="color:rgb(171,227,56)">'subsystem'</span> <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span>>
    <source>
      <vendor <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x</span>090c<span style="color:rgb(171,227,56)">'</span>/>
      <product <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x</span>1000<span style="color:rgb(171,227,56)">'</span>/>
    </source>
  </hostdev></code></pre></div><div>[3]: under <devices> added</div><div><pre class="gmail-MarkdownCodeBlock_preTag__dDgT9" style="margin-top:0px;margin-bottom:0px;font-size:14px;padding:0.5em;background:rgb(43,43,43);overflow-x:auto;color:rgb(248,248,242)"><code class="gmail-MarkdownCodeBlock_codeTag__ipdCC" style="background-color:transparent;padding:0px;font-family:Consolas,monaco,monospace;word-break:break-all"><hostdev <span style="color:rgb(255,215,0)">mode</span>=<span style="color:rgb(171,227,56)">'subsystem'</span> <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span> <span style="color:rgb(255,215,0)">managed</span>=<span style="color:rgb(171,227,56)">'yes'</span>>
  <source>
    <vendor <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x090c'</span>/>
    <product <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x1000'</span>/>
  </source>
  <address <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'pci'</span> <span style="color:rgb(255,215,0)">domain</span>=<span style="color:rgb(171,227,56)">'0x0000'</span> <span style="color:rgb(255,215,0)">bus</span>=<span style="color:rgb(171,227,56)">'0x00'</span> <span style="color:rgb(255,215,0)">slot</span>=<span style="color:rgb(171,227,56)">'0x01'</span> <span style="color:rgb(255,215,0)">function</span>=<span style="color:rgb(171,227,56)">'0x0'</span>/>
</hostdev></code></pre></div><div>[4]: under <devices> added</div><div><pre class="gmail-MarkdownCodeBlock_preTag__dDgT9" style="margin-top:0px;margin-bottom:0px;font-size:14px;padding:0.5em;background:rgb(43,43,43);overflow-x:auto;color:rgb(248,248,242)"><code class="gmail-MarkdownCodeBlock_codeTag__ipdCC" style="background-color:transparent;padding:0px;font-family:Consolas,monaco,monospace;word-break:break-all"><controller <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span> <span style="color:rgb(255,215,0)">model</span>=<span style="color:rgb(171,227,56)">'nec-xhci'</span> <span style="color:rgb(255,215,0)">index</span>=<span style="color:rgb(171,227,56)">'0'</span>/>
  <hostdev <span style="color:rgb(255,215,0)">mode</span>=<span style="color:rgb(171,227,56)">'subsystem'</span> <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span> <span style="color:rgb(255,215,0)">managed</span>=<span style="color:rgb(171,227,56)">'yes'</span>>
    <source>
      <vendor <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x090c'</span>/>
      <product <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x1000'</span>/>
    </source>
    <address <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'pci'</span> <span style="color:rgb(255,215,0)">domain</span>=<span style="color:rgb(171,227,56)">'0x0000'</span> <span style="color:rgb(255,215,0)">bus</span>=<span style="color:rgb(171,227,56)">'0x00'</span> <span style="color:rgb(255,215,0)">slot</span>=<span style="color:rgb(171,227,56)">'0x01'</span> <span style="color:rgb(255,215,0)">function</span>=<span style="color:rgb(171,227,56)">'0x0'</span>/>
  </hostdev></code></pre></div><div>[5]:</div><div><pre class="gmail-MarkdownCodeBlock_preTag__dDgT9" style="margin-top:0px;margin-bottom:0px;font-size:14px;padding:0.5em;background:rgb(43,43,43);overflow-x:auto;color:rgb(248,248,242)"><code class="gmail-MarkdownCodeBlock_codeTag__ipdCC" style="background-color:transparent;padding:0px;font-family:Consolas,monaco,monospace;word-break:break-all"><controller <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span> <span style="color:rgb(255,215,0)">index</span>=<span style="color:rgb(171,227,56)">'0'</span>>
  <address <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'pci'</span> <span style="color:rgb(255,215,0)">domain</span>=<span style="color:rgb(171,227,56)">'0x0000'</span> <span style="color:rgb(255,215,0)">bus</span>=<span style="color:rgb(171,227,56)">'0x00'</span> <span style="color:rgb(255,215,0)">slot</span>=<span style="color:rgb(171,227,56)">'0x01'</span> <span style="color:rgb(255,215,0)">function</span>=<span style="color:rgb(171,227,56)">'0x2'</span>/>
</controller>
<hostdev <span style="color:rgb(255,215,0)">mode</span>=<span style="color:rgb(171,227,56)">'subsystem'</span> <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span> <span style="color:rgb(255,215,0)">managed</span>=<span style="color:rgb(171,227,56)">'yes'</span>>
  <source>
    <vendor <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x090c'</span>/>
    <product <span style="color:rgb(255,215,0)">id</span>=<span style="color:rgb(171,227,56)">'0x1000'</span>/>
  </source>
  <address <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span> <span style="color:rgb(255,215,0)">bus</span>=<span style="color:rgb(171,227,56)">'1'</span> <span style="color:rgb(255,215,0)">port</span>=<span style="color:rgb(171,227,56)">'2'</span>/>
  <controller <span style="color:rgb(255,215,0)">type</span>=<span style="color:rgb(171,227,56)">'usb'</span> <span style="color:rgb(255,215,0)">index</span>=<span style="color:rgb(171,227,56)">'0'</span>/>
</hostdev></code></pre></div><div><br></div><div><div style="text-align:center"><b>%Start the VM</b></div></div><div><i>expected behavior:</i></div><div>          when login to the VM, lsusb or df -h shows the USB<br><i>what happened:</i></div><div>          it wont show the USB from the VM</div><div><div><br></div><div><b>OR </b>virsh dumpxml instance-0000000a > instance-0000000a.xml</div><div>and then change the configs as above and then </div></div><div><pre class="gmail-MarkdownCodeBlock_preTag__dDgT9" style="margin-top:0px;margin-bottom:0px;font-size:14px;padding:0.5em;background:rgb(43,43,43);overflow-x:auto;color:rgb(248,248,242)"><code class="gmail-MarkdownCodeBlock_codeTag__ipdCC" style="background-color:transparent;padding:0px;font-family:Consolas,monaco,monospace;word-break:break-all">virsh attach-device<span style="color:rgb(245,171,53)"> instance-0000000a </span>--file /path/to/updated-instance-0000000a.xml --config</code></pre></div><div><b><i><u><font size="4"><br></font></u></i></b></div><div><b><i><u><font size="6">Hot-Plug :</font></u></i></b><br></div><div><div><div style="text-align:center"><i><b>$ lsusb  (on host)</b></i></div></div><div>Bus 001 Device 0<span style="background-color:rgb(255,0,255)">14</span>: ID 090c:1000 Silicon Motion <font size="1">>>>> Note Device number changed every time I disconnect the device. So it might be different in the changed attempt shown below)</font></div><div style="text-align:center"><br></div><div><div style="text-align:center"><i><b>$ docker exec -it nova_libvirt /bin/bash</b></i></div><div style="text-align:center"><i><b># virsh list --all</b></i></div> Id   Name                State<br>---------------------------------------------<br> 2    instance-00000002   running</div><div>19   instance-00000008   running</div><div>20   instance-0000000a   running</div></div><div><br></div><div><br></div><div style="text-align:center"><b>#nano USB.xml</b></div><div style="text-align:center"><b>%add changes explained in </b>[1][2][3][4],...</div><div style="text-align:center"><b>$ virsh attach-device 

instance-0000000a   /path/to/USB.xml/file<br></b></div><div><br><div><i>expected behavior:</i></div><div>          lsusb or df -h shows the USB<br><i>what happened:</i></div><div>          it wont show the USB from the VM</div></div><div><br></div><div><br><font size="4"><b><i><u>Can you please guide me through this? Any recommendation would be much appreciated!<br>Any custom changes comes to your mind ( Reply it) would be solution for this problem /;<br></u></i></b></font><br>Thanks<br>Best regards</div></div>