[Users] OpenVZ guest device passthrough

Charles N Wyble charles at knownelement.com
Mon Nov 22 01:29:46 EST 2010


On 11/21/2010 10:17 PM, John Knight wrote:
> 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).

Thanks.

>
> 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.  )

Ah I see. It wasn't immediately clear to me from the man page if the 
path specification was /dev/device or just device. That clears things up 
a fair amount.  Now I have to figure out what device in /dev I would use 
for a USB wireless card. :)

>
> 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

Ah right.

>
>
> 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.
>
>

Fantastic. Thanks. I'll give it a shot and let the list know.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://openvz.org/pipermail/users/attachments/20101121/f3ed86a8/attachment.html


More information about the Users mailing list