Re: [PATCH 09/23] Add support for disks with LXC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2012/12/01 04:26, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Currently LXC guests can be given arbitrary pre-mounted
> filesystems, however, for some usecases it is more appropriate
> to provide block devices which the container can mount itself.
> This first impl only allows for <disk type='block'>, in other
> words exposing a host disk device to a container. Since LXC
> does not have device namespace virtualization, we are cheating
> a little bit. If the XML specifies /dev/sdc4 to be given to
> the container as /dev/sda1, when we do the mknod /dev/sda1
> in the container's /dev, we actually use the major:minor
> number of /dev/sdc4, not /dev/sda1.
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/lxc/lxc_cgroup.c    |  18 +++++++++
>  src/lxc/lxc_container.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 122 insertions(+)
> 
> diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
> index 767ef26..0636869 100644
> --- a/src/lxc/lxc_cgroup.c
> +++ b/src/lxc/lxc_cgroup.c
> @@ -332,6 +332,24 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def,
>          }
>      }
>  
> +    for (i = 0 ; i < def->ndisks ; i++) {
> +        if (def->disks[i]->type != VIR_DOMAIN_DISK_TYPE_BLOCK)
> +            continue;

You return error when type != VIR_DOMAIN_DISK_TYPE_BLOCK in lxcContainerSetupDisk,
So I think you can return error immediately here too.

Just this little advice.

ACK.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]