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

Re: [libvirt] [PATCH 02/16] LXC from native: import rootfs



On Tue, Jan 14, 2014 at 02:49:51PM +0100, Cédric Bosdonnat wrote:
> LXC rootfs can be either a directory or a block device or an image
> file. The first two types have been implemented, but the image file is
> still to be done since LXC auto-guesses the file format at mount time
> and the LXC driver doesn't support the 'auto' format.
> ---
>  src/lxc/lxc_native.c                         | 70 ++++++++++++++++++++++++++++
>  tests/lxcconf2xmldata/lxcconf2xml-simple.xml |  4 ++
>  2 files changed, 74 insertions(+)
> 

> +static int
> +lxcSetRootfs(virDomainDefPtr def,
> +             virPropertiesPtr properties)
> +{
> +    char *fssrc = NULL;
> +    char *fsdst = NULL;
> +    struct stat sb;
> +    int type = VIR_DOMAIN_FS_TYPE_MOUNT;
> +
> +    if (VIR_STRDUP(fssrc, virPropertiesLookup(properties, "lxc.rootfs")) < 0 ||
> +            VIR_STRDUP(fsdst, "/") < 0)
> +        goto error;
> +
> +    if (stat(fssrc, &sb) < 0)
> +        goto error;
> +
> +    if (S_ISBLK(sb.st_mode))
> +        type = VIR_DOMAIN_FS_TYPE_BLOCK;

I don't think we can assume that we can access the files listed in
the config. The user might be just asking us to convert the file
format, without the files being uploaded yet. So I think we must
remove the 'stat' call, and instead do a "best effort" check of
STRPREFIX(fssrc, "/dev") instead

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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