WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH, v2] libxl: sane disk backend selection and valid

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH, v2] libxl: sane disk backend selection and validation
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Thu, 7 Jul 2011 12:29:25 +0100
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 07 Jul 2011 04:25:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <19988.34830.646646.818359@xxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <19988.31275.221429.48662@xxxxxxxxxxxxxxxxxxxxxxxx> <1309967359.634.183.camel@xxxxxxxxxxxxxxxxxxxxxx> <19988.34830.646646.818359@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Wed, 6 Jul 2011, Ian Jackson wrote:
> +static int disk_try_backend(disk_try_backend_args *a,
> +                            libxl_disk_backend backend) {
> +    /* returns 0 (ie, DISK_BACKEND_UNKNOWN) on failure, or
> +     * backend on success */
> +    libxl_ctx *ctx = libxl__gc_owner(a->gc);
> +    switch (backend) {
> +
> +    case LIBXL_DISK_BACKEND_PHY:
> +        if (!(a->disk->format == LIBXL_DISK_FORMAT_RAW ||
> +              a->disk->format == LIBXL_DISK_FORMAT_EMPTY)) {
> +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend phy"
> +                       " unsuitable due to format %s",
> +                       a->disk->vdev,
> +                       libxl_disk_format_to_string(a->disk->format));
> +            return 0;
> +        }
> +        if (a->disk->format != LIBXL_DISK_FORMAT_EMPTY &&
> +            !S_ISBLK(a->stab.st_mode)) {
> +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend phy"
> +                       " unsuitable as phys path not a block device",
> +                       a->disk->vdev);
> +            return ERROR_INVAL;
> +        }
> +
> +        return backend;
> +
> +    case LIBXL_DISK_BACKEND_TAP:
> +        if (!libxl__blktap_enabled(a->gc)) {
> +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend tap"
> +                       " unsuitable because blktap not available",
> +                       a->disk->vdev);
> +            return 0;
> +        }
> +        if (a->disk->format == LIBXL_DISK_FORMAT_EMPTY ||
> +            (S_ISREG(a->stab.st_mode) && !a->stab.st_size)) {
> +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Disk vdev=%s, backend tap"
> +                       " unsuitable because empty devices not supported",
> +                       a->disk->vdev);
> +            return 0;
> +        }
> +        return backend;
> +

TAP should only be used for raw or vhd formats, not for qcow or qcow2.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel