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

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



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.