Vagrant Libvirt USB pass-through filter function

104 views
Skip to first unread message

_nobody_ _nobody_

unread,
Mar 9, 2018, 9:32:41 AM3/9/18
to Vagrant
Hello to everyone,

I have a question. I did successful project with Vagrant, bringing up Virtual Box VM.

Now, I would like to do the same with Vagrant libvirt VM.

Here is what I have as function for USB pass-through filter in Vagrant VirtualBox:

def better_usbfilter_add(vb, vendor_id, product_id, filter_name)
  # This is a workaround for the fact VirtualBox doesn't provide
  # a way for preventing duplicate USB filters from being added.
  #
  # TODO: Implement this in a way that it doesn't get run multiple
  #       times on each Vagrantfile parsing.
  if not usbfilter_exists(vendor_id, product_id)
    vb.customize ["usbfilter", "add", "0",
                  "--target", :id,
                  "--name", filter_name,
                  "--vendorid", vendor_id,
                  "--productid", product_id
                  ]
  end
end

And the Vagrant Vbox calls look like:

    better_usbfilter_add(vbox, "0B95", "7720", "ASIX Electronics Corp. AX88772 [0001]")
    better_usbfilter_add(vbox, "067B", "2303", "USB-Serial Controller")

How the exact function would look like for Vagrant libvirt? libvirt.customize does not exist, as I understand???

In other words, I would like to pass couple USB devices from host to VM.

Thank you,
_nobody_

Reply all
Reply to author
Forward
0 new messages