[libvirt] [PATCH v2 4/6] vol: Add thin_pool to _virStorageVolSource

Pavel Hrdina phrdina at redhat.com
Mon Feb 1 12:45:12 UTC 2016


On Thu, Jan 28, 2016 at 05:44:07PM -0500, John Ferlan wrote:
> A thin lv doesn't have any extents defined - rather it uses a concept of
> a "thin-pool" in order to describe it's source. In order to allow that to
> be displayed properly in a future patch, add a new 'thin_pool' name that
> can be used by a future patch to store the name of the source thin_pool
> name used by a thin logical volume.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/conf/storage_conf.c | 5 +++++
>  src/conf/storage_conf.h | 1 +
>  2 files changed, 6 insertions(+)
> 
> diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
> index 3657dfd..8ceb465 100644
> --- a/src/conf/storage_conf.c
> +++ b/src/conf/storage_conf.c
> @@ -322,6 +322,7 @@ virStorageVolDefFree(virStorageVolDefPtr def)
>      for (i = 0; i < def->source.nextent; i++)
>          VIR_FREE(def->source.extents[i].path);
>      VIR_FREE(def->source.extents);
> +    VIR_FREE(def->source.thin_pool);
>  
>      virStorageSourceClear(&def->target);
>      VIR_FREE(def);
> @@ -1655,6 +1656,10 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
>              virBufferAddLit(&buf, "</device>\n");
>      }
>  
> +    if (def->source.thin_pool)
> +        virBufferEscapeString(&buf, "<name>%s</name>\n",
> +                              def->source.thin_pool);

I'm not sure about the element to be called "name".  I would suggest something
like <thinpool name=''/>.  Otherwise it looks good.

Pavel

> +
>      virBufferAdjustIndent(&buf, -2);
>      virBufferAddLit(&buf, "</source>\n");
>  
> diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
> index f1dc62b..7e15a70 100644
> --- a/src/conf/storage_conf.h
> +++ b/src/conf/storage_conf.h
> @@ -55,6 +55,7 @@ struct _virStorageVolSource {
>  
>      int partType; /* virStorageVolTypeDisk, only used by disk
>                     * backend for partition type creation */
> +    char *thin_pool; /* Used to print/dumpxml the thin pool name */
>  };




More information about the libvir-list mailing list