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

Re: [libvirt] [PATCH v5 3/5] storage: add support for creating qcow2 images with extensions



On 06/20/2013 02:00 PM, Martin Kletzander wrote:
> On 06/19/2013 05:24 PM, Ján Tomko wrote:
>> Add -o compat= and -o lazy_refcounts options for qemu-img.
>> ---
>>  src/storage/storage_backend.c                   | 62 ++++++++++++++++++++++---
>>  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, 126 insertions(+), 7 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 deea850..b2c9608 100644
>> --- a/src/storage/storage_backend.c
>> +++ b/src/storage/storage_backend.c
>> @@ -633,9 +633,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)
>> @@ -643,16 +649,45 @@ virStorageBackendCreateQemuImgOpts(char **opts,
>>      if (preallocate)
>>          virBufferAddLit(&buf, "preallocation=metadata,");
>>  
>> +    if (compat)
>> +        virBufferAsprintf(&buf, "compat=%s,", compat);
>> +    if (features && format == VIR_STORAGE_FILE_QCOW2) {
>> +        for (i = 0; i < VIR_STORAGE_FILE_FEATURE_LAST; i++) {
>> +            ignore_value(virBitmapGetBit(features, i, &b));
>> +            if (b) {
>> +                switch (i) {
> 
> Either have that 'i' as virStorageFeature (or whatever the name of the
> enum is) or cast it here so there is a check for all possible values
> without default).
> 
>> +                case VIR_STORAGE_FILE_FEATURE_LAZY_REFCOUNTS:
>> +                    if (STREQ(compat, "0.10")) {
> 
> /STREQ/STREQ_NULLABLE/
> 
> [...]
>> diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
>> index 92ab2f2..25ff5a7 100644
>> --- a/tests/storagevolxml2argvtest.c
>> +++ b/tests/storagevolxml2argvtest.c
>> @@ -188,6 +188,8 @@ mymain(void)
>>              "qcow2-nobacking-none", 0, FMT_NONE);
>>      DO_TEST(false, "pool-dir", "vol-qcow2-nobacking", "vol-file",
>>              "qcow2-nobacking-convert-none", 0, FMT_NONE);
>> +    DO_TEST(false, "pool-dir", "vol-qcow2-lazy", NULL, "qcow2-lazy", 0, FMT_OPTIONS);
>> +    DO_TEST(false, "pool-dir", "vol-qcow2-1.1", NULL, "qcow2-1.1", 0, FMT_OPTIONS);
>>  
> 
> Wrap those lines and add a test with compat=0.10,lazy_refcounts=on.
> 
> ACK with nits fixed.

Fixed and pushed along with patches 1 and 2.

Thank you!

Jan


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