[lxc-users] Adding a host block device to a container

Peter Steele pwsteele at gmail.com
Tue Sep 1 15:39:14 UTC 2015


On 09/01/2015 07:25 AM, Serge Hallyn wrote:
> FWIW there is a lxc-device command that will do the mknod for you,
> but it won't be persistent (iirc).  Support for making that
> persistent would be welcome.  I think that would come in three small
> pieces:
>
> . have src/lxc/lxc_device optionally save the container configuration
>    when done.
> . have do_add_remove_node() manipulate a new list of devices to be
>    created at container start.
> . have src/lxc/conf.c:fill_autodev create devices which are in the new
>    list

I definitely want this to be persistent, and in my case it's intended to 
be all part of an automation process. The containers are created 
programmatically and certain types of containers will be assigned 
certain block devices. Once this setup is done, the containers won't 
change. Because it's automated it doesn't really matter that I have to 
set lxc.cgroup.devices.allow as well as do an mknod, but a single 
operation similar to what's provided by libvirt-lxc would be nice. The 
same exercise with libvirt is done with the command

virsh --connect lxc:/// attach-disk <container-name> <host-dev> 
<container-dev> --persistent --config




More information about the lxc-users mailing list