[libvirt] [PATCH 15/16] LXC from native: map block filesystems

Daniel P. Berrange berrange at redhat.com
Fri Jan 24 13:57:26 UTC 2014


On Tue, Jan 14, 2014 at 02:50:04PM +0100, Cédric Bosdonnat wrote:
> ---
>  src/lxc/lxc_native.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
> index 1c0f325..5ba6f94 100644
> --- a/src/lxc/lxc_native.c
> +++ b/src/lxc/lxc_native.c
> @@ -471,6 +471,7 @@ lxcAddFstabLine(virDomainDefPtr def, lxcFstabPtr fstab, unsigned long memory)
>      bool readonly;
>      int type = VIR_DOMAIN_FS_TYPE_MOUNT;
>      unsigned long long usage = 0;
> +    struct stat sb;
>  
>      if (fstab->dst[0] != '/') {
>          if (virAsprintf(&dst, "/%s", fstab->dst) < 0)
> @@ -501,6 +502,10 @@ lxcAddFstabLine(virDomainDefPtr def, lxcFstabPtr fstab, unsigned long memory)
>      } else if (VIR_STRDUP(src, fstab->src) < 0)
>          goto error;
>  
> +    /* Is it a block device that needs special favor? */
> +    if (stat(fstab->src, &sb) >= 0 && S_ISBLK(sb.st_mode))
> +        type = VIR_DOMAIN_FS_TYPE_BLOCK;

Here we'll have to do the STRPREFIX(src, "/dev") approach again
instead of stat()


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




More information about the libvir-list mailing list