[Qemu-devel] [PATCH] iotests: fix 254 for qcow (1)

Vladimir Sementsov-Ogievskiy posted 1 patch 4 years, 10 months ago
Test s390x passed
Test checkpatch passed
Test asan passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190605152650.103483-1-vsementsov@virtuozzo.com
Maintainers: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
tests/qemu-iotests/254     | 5 +++--
tests/qemu-iotests/254.out | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
[Qemu-devel] [PATCH] iotests: fix 254 for qcow (1)
Posted by Vladimir Sementsov-Ogievskiy 4 years, 10 months ago
Qcow default cluster size is 4k, but default format of created overlay
image on snapshot operation is qcow2 with it's default cluster of 64k.

This leads to block-dirty-bitmap-merge fail when test run for qcow
format, as it can't merge bitmaps with different granularities.
Let's fix it by specifying strict granularity.

Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/254     | 5 +++--
 tests/qemu-iotests/254.out | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254
index 33cb80a512..a8ea5818ff 100755
--- a/tests/qemu-iotests/254
+++ b/tests/qemu-iotests/254
@@ -29,7 +29,8 @@ qemu_img_create('-f', iotests.imgfmt, disk, str(size))
 vm = iotests.VM().add_drive(disk, opts='node-name=base')
 vm.launch()
 
-vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0')
+vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0',
+           granularity=65536)
 
 vm.hmp_qemu_io('drive0', 'write 0 512K')
 
@@ -38,7 +39,7 @@ vm.qmp_log('transaction', indent=2, actions=[
      'data': {'device': 'drive0', 'snapshot-file': top,
               'snapshot-node-name': 'snap'}},
     {'type': 'block-dirty-bitmap-add',
-     'data': {'node': 'snap', 'name': 'bitmap0'}},
+     'data': {'node': 'snap', 'name': 'bitmap0', 'granularity': 65536}},
     {'type': 'block-dirty-bitmap-merge',
      'data': {'node': 'snap', 'target': 'bitmap0',
               'bitmaps': [{'node': 'base', 'name': 'bitmap0'}]}}
diff --git a/tests/qemu-iotests/254.out b/tests/qemu-iotests/254.out
index d7394cf002..dc899016da 100644
--- a/tests/qemu-iotests/254.out
+++ b/tests/qemu-iotests/254.out
@@ -1,4 +1,4 @@
-{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "node": "drive0"}}
+{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
 {"return": {}}
 {
   "execute": "transaction",
@@ -14,6 +14,7 @@
       },
       {
         "data": {
+          "granularity": 65536,
           "name": "bitmap0",
           "node": "snap"
         },
-- 
2.18.0


Re: [Qemu-devel] [PATCH] iotests: fix 254 for qcow (1)
Posted by Max Reitz 4 years, 10 months ago
On 05.06.19 17:26, Vladimir Sementsov-Ogievskiy wrote:
> Qcow default cluster size is 4k, but default format of created overlay
> image on snapshot operation is qcow2 with it's default cluster of 64k.

Then I wonder why we run this test even for anything but qcow2.

I forgot to mention that this test also fails for all image formats that
do not support image creation.  So we need some form of
iotests.verify_image_format() anyway.  If half of this test requires
qcow2, and the other half does not really care about the image format,
then why not just restrict it to qcow2 altogether.

(Or restrict it to all formats that support backing files, and then
explicitly specify the format when creating the snapshot?)

Max

> This leads to block-dirty-bitmap-merge fail when test run for qcow
> format, as it can't merge bitmaps with different granularities.
> Let's fix it by specifying strict granularity.
> 
> Reported-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  tests/qemu-iotests/254     | 5 +++--
>  tests/qemu-iotests/254.out | 3 ++-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254
> index 33cb80a512..a8ea5818ff 100755
> --- a/tests/qemu-iotests/254
> +++ b/tests/qemu-iotests/254
> @@ -29,7 +29,8 @@ qemu_img_create('-f', iotests.imgfmt, disk, str(size))
>  vm = iotests.VM().add_drive(disk, opts='node-name=base')
>  vm.launch()
>  
> -vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0')
> +vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0',
> +           granularity=65536)
>  
>  vm.hmp_qemu_io('drive0', 'write 0 512K')
>  
> @@ -38,7 +39,7 @@ vm.qmp_log('transaction', indent=2, actions=[
>       'data': {'device': 'drive0', 'snapshot-file': top,
>                'snapshot-node-name': 'snap'}},
>      {'type': 'block-dirty-bitmap-add',
> -     'data': {'node': 'snap', 'name': 'bitmap0'}},
> +     'data': {'node': 'snap', 'name': 'bitmap0', 'granularity': 65536}},
>      {'type': 'block-dirty-bitmap-merge',
>       'data': {'node': 'snap', 'target': 'bitmap0',
>                'bitmaps': [{'node': 'base', 'name': 'bitmap0'}]}}
> diff --git a/tests/qemu-iotests/254.out b/tests/qemu-iotests/254.out
> index d7394cf002..dc899016da 100644
> --- a/tests/qemu-iotests/254.out
> +++ b/tests/qemu-iotests/254.out
> @@ -1,4 +1,4 @@
> -{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "node": "drive0"}}
> +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
>  {"return": {}}
>  {
>    "execute": "transaction",
> @@ -14,6 +14,7 @@
>        },
>        {
>          "data": {
> +          "granularity": 65536,
>            "name": "bitmap0",
>            "node": "snap"
>          },
> 


Re: [Qemu-devel] [PATCH] iotests: fix 254 for qcow (1)
Posted by Vladimir Sementsov-Ogievskiy 4 years, 10 months ago
05.06.2019 18:33, Max Reitz wrote:
> On 05.06.19 17:26, Vladimir Sementsov-Ogievskiy wrote:
>> Qcow default cluster size is 4k, but default format of created overlay
>> image on snapshot operation is qcow2 with it's default cluster of 64k.
> 
> Then I wonder why we run this test even for anything but qcow2.
> 
> I forgot to mention that this test also fails for all image formats that
> do not support image creation.  So we need some form of
> iotests.verify_image_format() anyway.  If half of this test requires
> qcow2, and the other half does not really care about the image format,
> then why not just restrict it to qcow2 altogether.

Hmm, then better restrict to qcow2 ofcourse.

> 
> (Or restrict it to all formats that support backing files, and then
> explicitly specify the format when creating the snapshot?)
> 
> Max
> 
>> This leads to block-dirty-bitmap-merge fail when test run for qcow
>> format, as it can't merge bitmaps with different granularities.
>> Let's fix it by specifying strict granularity.
>>
>> Reported-by: Max Reitz <mreitz@redhat.com>
>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>> ---
>>   tests/qemu-iotests/254     | 5 +++--
>>   tests/qemu-iotests/254.out | 3 ++-
>>   2 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254
>> index 33cb80a512..a8ea5818ff 100755
>> --- a/tests/qemu-iotests/254
>> +++ b/tests/qemu-iotests/254
>> @@ -29,7 +29,8 @@ qemu_img_create('-f', iotests.imgfmt, disk, str(size))
>>   vm = iotests.VM().add_drive(disk, opts='node-name=base')
>>   vm.launch()
>>   
>> -vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0')
>> +vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0',
>> +           granularity=65536)
>>   
>>   vm.hmp_qemu_io('drive0', 'write 0 512K')
>>   
>> @@ -38,7 +39,7 @@ vm.qmp_log('transaction', indent=2, actions=[
>>        'data': {'device': 'drive0', 'snapshot-file': top,
>>                 'snapshot-node-name': 'snap'}},
>>       {'type': 'block-dirty-bitmap-add',
>> -     'data': {'node': 'snap', 'name': 'bitmap0'}},
>> +     'data': {'node': 'snap', 'name': 'bitmap0', 'granularity': 65536}},
>>       {'type': 'block-dirty-bitmap-merge',
>>        'data': {'node': 'snap', 'target': 'bitmap0',
>>                 'bitmaps': [{'node': 'base', 'name': 'bitmap0'}]}}
>> diff --git a/tests/qemu-iotests/254.out b/tests/qemu-iotests/254.out
>> index d7394cf002..dc899016da 100644
>> --- a/tests/qemu-iotests/254.out
>> +++ b/tests/qemu-iotests/254.out
>> @@ -1,4 +1,4 @@
>> -{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "node": "drive0"}}
>> +{"execute": "block-dirty-bitmap-add", "arguments": {"granularity": 65536, "name": "bitmap0", "node": "drive0"}}
>>   {"return": {}}
>>   {
>>     "execute": "transaction",
>> @@ -14,6 +14,7 @@
>>         },
>>         {
>>           "data": {
>> +          "granularity": 65536,
>>             "name": "bitmap0",
>>             "node": "snap"
>>           },
>>
> 
> 


-- 
Best regards,
Vladimir