[libvirt] [PATCH v2 3/9] virstoragefile: Add virStorageSourceSetBackingStore

Michal Privoznik mprivozn at redhat.com
Wed Jan 28 10:10:08 UTC 2015


On 21.01.2015 16:29, Matthias Gatto wrote:
> As explained for virStorageSourceGetBackingStore, quorum allows
> multiple backing store, this make the operation to set bs complex
> because we have to check if the backingStore is used as an array
> or a pointer, and set it differently in both case.
> 
> In order to help the manipulation of backing store, I've added a
> function virStorageSourceSetBackingStore.
> 
> For now virStorageSourceSetBackingStore don't handle the case where
> we have more than one backing store in virStorageSource.
> 
> Signed-off-by: Matthias Gatto <matthias.gatto at outscale.com>
> ---
>  src/libvirt_private.syms  |  1 +
>  src/util/virstoragefile.c | 10 ++++++++++
>  src/util/virstoragefile.h |  3 +++
>  3 files changed, 14 insertions(+)
> 
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index 3f4d02c..980235b 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -2033,6 +2033,7 @@ virStorageSourceParseRBDColonString;
>  virStorageSourcePoolDefFree;
>  virStorageSourcePoolModeTypeFromString;
>  virStorageSourcePoolModeTypeToString;
> +virStorageSourceSetBackingStore;
>  virStorageTypeFromString;
>  virStorageTypeToString;
>  
> diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
> index 052debf..84eefa3 100644
> --- a/src/util/virstoragefile.c
> +++ b/src/util/virstoragefile.c
> @@ -1806,6 +1806,16 @@ virStorageSourceGetBackingStore(const virStorageSource *src,
>  }
>  
>  
> +virStorageSourcePtr
> +virStorageSourceSetBackingStore(virStorageSourcePtr src,
> +                                virStorageSourcePtr backingStore,
> +                                size_t pos ATTRIBUTE_UNUSED)
> +{
> +    src->backingStore = backingStore;
> +    return src->backingStore;
> +}
> +
> +
>  /**
>   * virStorageSourcePtr:
>   *
> diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
> index c37ddcf..d5cf7e6 100644
> --- a/src/util/virstoragefile.h
> +++ b/src/util/virstoragefile.h
> @@ -289,6 +289,9 @@ struct _virStorageSource {
>  #  define DEV_BSIZE 512
>  # endif
>  
> +virStorageSourcePtr virStorageSourceSetBackingStore(virStorageSourcePtr src,
> +                                                    virStorageSourcePtr backingStore,
> +                                                    size_t pos);
>  virStorageSourcePtr virStorageSourceGetBackingStore(const virStorageSource *src,
>                                                      size_t pos);
>  
> 

ACK

Michal




More information about the libvir-list mailing list