[Users] OpenVZ guest device passthrough

John Knight jknight at aretta.com
Mon Nov 22 01:17:44 EST 2010


Hi Charles,

OpenVZ does support passthrough to varying success rates depending on 
what you're doing (but I have yet to really find anything it doesn't 
work well with).

 From the hardware node, you would run:

"# vzctl set 1000 --devnodes device:rw --save"

(where '1000' is your container id and 'device' is the device you want 
to passthrough in /dev/.  In the above example you would be sharing the 
host node's /dev/device device.  )

Next, make sure that if a certain user beyond root needs access to this 
device that you set it up on the node and in the container:

vzctl exec 1000 chown -R user:group /dev/device
vzctl exec 1000 chown -R user:group /lib/udev/devices/device
adduser user
chown -R user:group /dev/device


So, summing it all up and giving an example, let's say you want to share 
the fictitional hardware device /dev/fake1 with container 1000 and in 
the container you need to make it accessible by the user and group "fake 
user".  The following are the commands you would use to do so:

------
# create the passthrough
vzctl set 1000 --devnode fake1:rw --save

# assign permissions
vzctl exec 1000 chown -R fake1:fake1 /dev/fake1
vzctl exec 1000 chown -R fake1:fake1 /lib/udev/devices/fake1

# add user on node so permissions stick through pam
adduser fake1
chown -R fake1:fake1 /dev/fake1
------

After performing the above from the hardware node the container is 
hosted on, you should now have a /dev/fake1 inside container 1000 with 
the correct permissions.



Hope that helps,

John Knight
Aretta Communications


On 11/21/2010 11:00 PM, Charles N Wyble wrote:
> Hello,
>
> I've been happily using openvz and proxmox (with only openvz guests) 
> for some time now.  Thank you very much for the fantastic work!
>
> I have a desire to pass through some PCI and USB devices to a USB 
> guest. Is this possible? I read the man page for vzctl and saw
>
>   --devnodes device:[r][w][q]|none
>               Give  the  container  an access (r - read, w - write, q 
> - disk quota management, none - no access) to a device designated by 
> the special file /dev/device. Device file is created in a container by 
> vzctl. Example: vzctl set 777 --devnodes sdb:rwq.
>
>
> but this seemed oriented towards disk drives. I'm not sure how to 
> reference a PCI or USB device.
>
> Searching around the net, I saw that KVM seems to support USB/PCI 
> passthrough. Does OpenVZ (or I should say proxmox with kernel
> Linux knel-prod-proxmox2 2.6.32-4-pve #1 SMP Thu Oct 21 09:35:29 CEST 
> 2010 x86_64 GNU/Linux) support arbitrary device pass through?
>
> Thanks!
>
> Please let me know if any additional information is required.
>
>
>
>
> -- 
> Charles N Wyble
> (818)280-7059 charles at knownelement.com
> President & CEO Known Element Enterprises
> _______________________________________________
> Users mailing list
> Users at openvz.org
> https://openvz.org/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openvz.org/pipermail/users/attachments/20101122/53121b40/attachment.html


More information about the Users mailing list