[libvirt] [PATCH 4/7] storage: add support for creating qcow2 images with extensions

Martin Kletzander mkletzan at redhat.com
Fri Jun 14 15:43:54 UTC 2013


On 06/10/2013 02:10 PM, Ján Tomko wrote:
> Add -o compat= and -o lazy_refcounts options for qemu-img.
> ---
>  src/storage/storage_backend.c                   | 36 +++++++++++++++++++++++--
>  tests/storagevolxml2argvdata/qcow2-1.1.argv     |  1 +
>  tests/storagevolxml2argvdata/qcow2-lazy.argv    |  1 +
>  tests/storagevolxml2argvdata/vol-qcow2-1.1.xml  | 32 ++++++++++++++++++++++
>  tests/storagevolxml2argvdata/vol-qcow2-lazy.xml | 35 ++++++++++++++++++++++++
>  tests/storagevolxml2argvtest.c                  |  2 ++
>  6 files changed, 105 insertions(+), 2 deletions(-)
>  create mode 100644 tests/storagevolxml2argvdata/qcow2-1.1.argv
>  create mode 100644 tests/storagevolxml2argvdata/qcow2-lazy.argv
>  create mode 100644 tests/storagevolxml2argvdata/vol-qcow2-1.1.xml
>  create mode 100644 tests/storagevolxml2argvdata/vol-qcow2-lazy.xml
> 
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index 0abc3f3..22cc051 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c
> @@ -655,9 +655,15 @@ static int
>  virStorageBackendCreateQemuImgOpts(char **opts,
>                                     const char *backingType,
>                                     bool encryption,
> -                                   bool preallocate)
> +                                   bool preallocate,
> +                                   int format,
> +                                   const char *compat,
> +                                   virBitmapPtr features)
>  {
>      virBuffer buf = VIR_BUFFER_INITIALIZER;
> +    bool b;
> +    int i;
> +
>      if (backingType)
>          virBufferAsprintf(&buf, "backing_fmt=%s,", backingType);
>      if (encryption)
> @@ -665,6 +671,19 @@ virStorageBackendCreateQemuImgOpts(char **opts,
>      if (preallocate)
>          virBufferAddLit(&buf, "preallocation=metadata,");
>  
> +    if (compat)
> +        virBufferAsprintf(&buf, "compat=%s,", compat);
> +    if (features && format == VIR_STORAGE_FILE_QCOW2) {
> +        if (!compat)
> +            virBufferAddLit(&buf, "compat=1.1,");

This is not needed, or is it?

Not looking at the tests until 3/7 is refactored, but other that that,
this one looks OK.

Martin




More information about the libvir-list mailing list