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

Re: [Xen-devel] [PATCH 04 of 16 RFC] blktap3: change libxl__blktap_devpath prototype to return an error code



On Wed, 2012-10-24 at 18:02 +0100, Thanos Makatos wrote:
> Make libxl__blktap_devpath return an error code instead of the device,
>  since there is no device in dom0 any more.

Does this function eventually go away then? Or will it eventually return
some sort of metadata which can be used to connect to the created tap
device?

>  Amend the libxl code that uses this functions accordingly.
> 
> diff -r 80e0bc67dcda -r bcb5a6182868 tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c     Wed Oct 24 17:24:53 2012 +0100
> +++ b/tools/libxl/libxl.c     Wed Oct 24 17:25:02 2012 +0100
> @@ -1844,13 +1844,14 @@ static void device_disk_add(libxl__egc *
>                  break;
>  
>              case LIBXL_DISK_BACKEND_TAP:
> -                dev = libxl__blktap_devpath(gc, disk->pdev_path, 
> disk->format);
> -                if (!dev) {
> -                    LOG(ERROR, "failed to get blktap devpath for %p\n",
> -                        disk->pdev_path);
> +                rc = libxl__blktap_devpath(gc, disk->pdev_path, 
> disk->format);
> +                if (rc) {
> +                    LOG(ERROR, "failed to get blktap devpath for %s: %s\n",
> +                        disk->pdev_path, strerror(rc));
>                      rc = ERROR_FAIL;
>                      goto out;
>                  }
> +                dev = NULL;
>                  flexarray_append(back, "tapdisk-params");
>                  flexarray_append(back, libxl__sprintf(gc, "%s:%s",
>                      libxl__device_disk_string_of_format(disk->format),
> @@ -2277,8 +2278,13 @@ void libxl__device_disk_local_initiate_a
>                  dev = disk->pdev_path;
>                  break;
>              case LIBXL_DISK_FORMAT_VHD:
> -                dev = libxl__blktap_devpath(gc, disk->pdev_path,
> -                                            disk->format);
> +                rc = libxl__blktap_devpath(gc, disk->pdev_path, 
> disk->format);
> +                if (!rc) {
> +                    LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
> +                           "error getting tapdisk: %s", strerror(rc));
> +                    rc = ERROR_FAIL;
> +                    goto out;
> +                }
>                  break;
>              case LIBXL_DISK_FORMAT_QCOW:
>              case LIBXL_DISK_FORMAT_QCOW2:
> diff -r 80e0bc67dcda -r bcb5a6182868 tools/libxl/libxl_blktap3.c
> --- a/tools/libxl/libxl_blktap3.c     Wed Oct 24 17:24:53 2012 +0100
> +++ b/tools/libxl/libxl_blktap3.c     Wed Oct 24 17:25:02 2012 +0100
> @@ -5,9 +5,9 @@ int libxl__blktap_enabled(libxl__gc *gc)
>      return 1;
>  }
>  
> -char *libxl__blktap_devpath(libxl__gc *gc, const char *disk,
> +int libxl__blktap_devpath(libxl__gc *gc, const char *disk,
>      libxl_disk_format format) {
> -    return NULL;
> +    return -ENOSYS;
>  }
>  
>  int libxl__device_destroy_tapdisk(libxl__gc *gc, const char *be_path) {
> diff -r 80e0bc67dcda -r bcb5a6182868 tools/libxl/libxl_internal.h
> --- a/tools/libxl/libxl_internal.h    Wed Oct 24 17:24:53 2012 +0100
> +++ b/tools/libxl/libxl_internal.h    Wed Oct 24 17:25:02 2012 +0100
> @@ -1344,10 +1344,9 @@ struct libxl__cpuid_policy {
>  /* libxl__blktap_devpath:
>   *    Argument: path and disk image as specified in config file.
>   *      The type specifies whether this is aio, qcow, qcow2, etc.
> - *    returns device path xenstore wants to have. returns NULL
> - *      if no device corresponds to the disk.
> + *    returns 0 on success, an error code otherwise 
>   */
> -_hidden char *libxl__blktap_devpath(libxl__gc *gc,
> +_hidden int libxl__blktap_devpath(libxl__gc *gc,
>                                      const char *disk,
>                                      libxl_disk_format format);
>  
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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