All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Kamala Narasimhan <kamala.narasimhan@gmail.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 2/5] Xl interface change plus changes to code it impacts
Date: Thu, 10 Feb 2011 11:50:42 +0000	[thread overview]
Message-ID: <alpine.DEB.2.00.1102101143110.7277@kaball-desktop> (raw)
In-Reply-To: <4D52DB1E.6080101@gmail.com>

On Wed, 9 Feb 2011, Kamala Narasimhan wrote:
> Description:
> 
> This patch refactors xl disk specific interface to separate disk format and backend types, rename some variables, changes code that is impacted by this interface change.
> 
> Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
> 
> Kamala
> 
> PS:  This patch incorporates all the comments made so far that are specific to this patch.

Better, we are almost there.
The only problems I have found are in the changes to
libxl_device_disk_local_attach:


> @@ -1052,36 +1051,44 @@ char * libxl_device_disk_local_attach(li
>      libxl__gc gc = LIBXL_INIT_GC(ctx);
>      const char *dev = NULL;
>      char *ret = NULL;
> -    int phystype = disk->phystype;
> -    switch (phystype) {
> -        case PHYSTYPE_PHY: {
> -            fprintf(stderr, "attaching PHY disk %s to domain 0\n", disk->physpath);
> -            dev = disk->physpath;
> +
> +    switch (disk->backend) {
> +        case DISK_BACKEND_PHY: {
> +            fprintf(stderr, "attaching PHY disk %s to domain 0\n", disk->pdev_path);
> +            dev = disk->pdev_path;
>              break;
>          }
> -        case PHYSTYPE_FILE:
> -            /* let's pretend is tap:aio for the moment */
> -            phystype = PHYSTYPE_AIO;
> -        case PHYSTYPE_AIO:
> -            if (!libxl__blktap_enabled(&gc)) {
> -                dev = disk->physpath;
> +        case DISK_BACKEND_TAP: {
> +            if (disk->format == DISK_FORMAT_VHD)
> +            {
> +                if (libxl__blktap_enabled(&gc))
> +                    dev = libxl__blktap_devpath(&gc, disk->pdev_path, disk->format);
> +                else
> +                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "tapdisk2 is required to open a vhd disk\n");
> +                break;
> +            } else if (disk->format == DISK_FORMAT_QCOW ||
> +                       disk->format == DISK_FORMAT_QCOW2) {
> +                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot locally attach a qcow or qcow2 disk image\n");
> +                break;
> +            } else {
> +                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend "
> +                    "type: %d\n", disk->backend);
>                  break;
>              }
> -        case PHYSTYPE_VHD:
> -            if (libxl__blktap_enabled(&gc))
> -                dev = libxl__blktap_devpath(&gc, disk->physpath, phystype);
> -            else
> -                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "tapdisk2 is required to open a vhd disk\n");
> +        }
> +        case DISK_BACKEND_QDISK: {
> +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot locally attach a qdisk "
> +                "image\n");
>              break;
> -        case PHYSTYPE_QCOW:
> -        case PHYSTYPE_QCOW2:
> -            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot locally attach a qcow or qcow2 disk image\n");
> +        }
> +        case DISK_BACKEND_UNKNOWN:
> +        default: {
> +            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend "
> +                "type: %d\n", disk->backend);
>              break;
> +        }
> +    }
>  
> -        default:
> -            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk physical type: %d\n", phystype);
> -            break;
> -    }
>      if (dev != NULL)
>          ret = strdup(dev);
>      libxl__free_all(&gc);
> 

The simple raw file case is not supported anywhere, besides it is
possible to attach a qdisk if it is in raw format.
It should be more or less like this:


phy && raw -> OK
phy && anything but raw -> KO
qdisk && raw -> OK
qdisk && anything but raw -> KO
tap && (qcow || qcow2) -> KO
tap && blktap2 enabled && (vhd || raw) -> OK
tap && blktap2 disabled && vhd -> KO
tap && blktap2 disabled && raw -> OK (same as qdisk)


> diff -r 1967c7c290eb tools/libxl/xl_cmdimpl.c
> --- a/tools/libxl/xl_cmdimpl.c	Wed Feb 09 12:03:09 2011 +0000
> +++ b/tools/libxl/xl_cmdimpl.c	Wed Feb 09 10:57:42 2011 -0500
> @@ -361,9 +361,9 @@ static void printf_info(int domid,
>          printf("\t\t(tap\n");
>          printf("\t\t\t(backend_domid %d)\n", d_config->disks[i].backend_domid);
>          printf("\t\t\t(domid %d)\n", d_config->disks[i].domid);
> -        printf("\t\t\t(physpath %s)\n", d_config->disks[i].physpath);
> -        printf("\t\t\t(phystype %d)\n", d_config->disks[i].phystype);
> -        printf("\t\t\t(virtpath %s)\n", d_config->disks[i].virtpath);
> +        printf("\t\t\t(physpath %s)\n", d_config->disks[i].pdev_path);
> +        printf("\t\t\t(phystype %d)\n", d_config->disks[i].backend);
> +        printf("\t\t\t(virtpath %s)\n", d_config->disks[i].vdev);
> 

we should print pdev_path, backend and vdev here

  parent reply	other threads:[~2011-02-10 11:50 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-07 21:15 [PATCH 0/5] xl disk configuration handling Kamala Narasimhan
2011-02-09 18:21 ` [PATCH 2/5] Xl interface change plus changes to code it impacts Kamala Narasimhan
2011-02-10  9:23   ` Ian Campbell
2011-02-10 14:44     ` Kamala Narasimhan
2011-02-10 11:50   ` Stefano Stabellini [this message]
2011-02-10 17:05     ` Kamala Narasimhan
2011-02-10 20:00       ` Kamala Narasimhan
2011-02-11 13:47         ` Stefano Stabellini
2011-02-11 14:45           ` Kamala Narasimhan
2011-02-11 15:19           ` Kamala Narasimhan
2011-02-11 15:26             ` Stefano Stabellini
2011-02-11 19:12             ` Kamala Narasimhan
2011-02-14 17:45               ` Ian Jackson
2011-02-14 18:30                 ` Kamala Narasimhan
2011-02-14 19:51                 ` Kamala Narasimhan
2011-02-15 19:22                   ` Ian Jackson
2011-02-15 19:38                     ` Kamala Narasimhan
2011-02-15 19:41                       ` Ian Jackson
2011-02-09 18:26 ` [PATCH 0/5] xl disk configuration handling Kamala Narasimhan
2011-02-07 21:22 [PATCH 2/5] Xl interface change plus changes to code it impacts Kamala Narasimhan
2011-02-08 14:38 ` Ian Campbell
2011-02-08 14:41   ` Ian Campbell
2011-02-08 18:42     ` Kamala Narasimhan
2011-02-10  9:02       ` Ian Campbell
2011-02-10 14:37         ` Kamala Narasimhan
2011-02-08 18:37   ` Kamala Narasimhan
2011-02-08 15:42 ` Ian Jackson
2011-02-08 18:56   ` Kamala Narasimhan
2011-02-08 16:42 ` Stefano Stabellini
2011-02-08 19:04   ` Kamala Narasimhan
2011-02-08 19:09     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1102101143110.7277@kaball-desktop \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=kamala.narasimhan@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.