[libvirt] [PATCH v3 2/3] storage: optional 'refresh' elemement on pool
Michal Privoznik
mprivozn at redhat.com
Tue Mar 19 15:59:39 UTC 2019
On 3/19/19 2:42 PM, jdillama at redhat.com wrote:
> From: Jason Dillaman <dillaman at redhat.com>
>
> The new 'refresh' element can override the default refresh operations
> for a storage pool. The only currently supported override is to set
> the volume allocation size to the volume capacity. This can be specified
> by adding the following snippet:
>
> <pool>
> ...
> <refresh>
> <volume allocation='capacity'/>
> </refresh>
> ...
> </pool>
>
> This is useful for certain backends where computing the actual allocation
> of a volume might be an expensive operation.
>
> Signed-off-by: Jason Dillaman <dillaman at redhat.com>
> ---
> docs/formatstorage.html.in | 27 +++++++++++++++++++
> docs/schemas/storagecommon.rng | 7 +++++
> docs/schemas/storagepool.rng | 23 ++++++++++++++++
> src/conf/storage_conf.c | 27 +++++++++++++++++++
> src/conf/storage_conf.h | 9 +++++++
> .../pool-rbd-refresh-volume-allocation.xml | 15 +++++++++++
> .../pool-rbd-refresh-volume-allocation.xml | 18 +++++++++++++
> tests/storagepoolxml2xmltest.c | 1 +
> 8 files changed, 127 insertions(+)
> create mode 100644 tests/storagepoolxml2xmlin/pool-rbd-refresh-volume-allocation.xml
> create mode 100644 tests/storagepoolxml2xmlout/pool-rbd-refresh-volume-allocation.xml
>
> diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
> index bfbebd15bd..f61d8f5a18 100644
> --- a/src/conf/storage_conf.h
> +++ b/src/conf/storage_conf.h
> @@ -83,6 +83,13 @@ struct _virStorageVolSource {
> * backend for partition type creation */
> };
>
> +typedef enum {
> + VIR_STORAGE_VOL_REFRESH_ALLOCATION_DEFAULT, /* compute actual allocation */
> + VIR_STORAGE_VOL_REFRESH_ALLOCATION_CAPACITY, /* use logical capacity */
> + VIR_STORAGE_VOL_REFRESH_ALLOCATION_LAST,
> +} virStorageVolRefreshAllocationType;
> +
> +VIR_ENUM_DECL(virStorageVolRefreshAllocation);
>
> typedef struct _virStorageVolDef virStorageVolDef;
> typedef virStorageVolDef *virStorageVolDefPtr;
> @@ -243,6 +250,8 @@ struct _virStoragePoolDef {
> unsigned char uuid[VIR_UUID_BUFLEN];
> int type; /* virStoragePoolType */
>
> + int refresh_volume_allocation; /* virStorageVolRefreshAllocationType */
We want our structures to be as close to XML as possible. I'm
introducing virStoragePoolDefRefresh and virStorageVolDefRefresh
structs, parser and formatter funcs and renaming the enum as a result of
that.
I was also playing with the placement of <refresh/> element within
<pool/> XML. At first I though it should go a bit higher - somewhere
close to <allocation/>, <capacity/> and <available/>. My reasoning was
that this tunes how those values are computed. But then I realized, for
storage pool XML we keep config knobs (e.g. namespace data) at the end.
So I'm keeping the element at the place you're introcing it - it's
correct after all.
Michal
More information about the libvir-list
mailing list