Can you see the USB device in the lxc?
My answering assumes you cannot see the USB device in the container. If you can see it, please ignore my answer.
According to my understanding, “hostdev mode='subsystem' “ is used with KVM only. We use this if we want to passthrough a device to a KVM virtual
machine. After doing that, the host machine will lose control of the device. If container is used, the container is not a real virtual machine, it’s just a group of processes and it shares the OS kernel with the host. If a device cannot be seen by the host
machine, I guess it also cannot been seen by the container.
I used the following XML scripts to expose a third-party PCIe card to the container successfully, and I can access the card in the lxc.
<hostdev mode=’capabilities’ type=’misc’>
<source>
<char/dev/mydevice</char>
</source>
</hostdev>
Although I am not sure if my card is a char device, but it really works.
If I use “ hostdev mode=’subsystem’”, it will fail to expose the PCIe card.
From: Filip Maj [mailto:fil@saucelabs.com]
Sent: 2014年4月14日
11:26
To: WANG Cheng D
Cc: libvirt-users@redhat.com
Subject: RE: [libvirt-users] LXC + USB passthrough = Operation not permitted
Hi Chang Weng,
Thanks for answering!
Could you explain why subsystem=USB does not make sense? I was simply following the documentation for USB devices (right above the section you linked to).
For what it's worth, I've also tried mounting the specific character device related to the appropriate android device into the container in the way you suggest, with no luck; `adb` still does not recognize the device.
On Apr 13, 2014 7:10 PM, "WANG Cheng D" <Cheng.d.Wang@alcatel-sbell.com.cn> wrote:
Dear Fil,
I am not sure if my answer can help you.
I had ever asked a similar question to Daniel and I was using a thirty-party card. As a container uses a shared kernel with the host, so hostdev mode='subsystem'
doesn’t make sense. Maybe you can try to use hostdev mode='capabilities’. Please see
http://libvirt.org/formatdomain.html#elementsHostDevCaps
Hope this helps
Cheng Wang