572ad9783f
The patch adds some preparation parts for incompatible compression type feature to qcow2 allowing the use different compression methods for image clusters (de)compressing. It is implied that the compression type is set on the image creation and can be changed only later by image conversion, thus compression type defines the only compression algorithm used for the image, and thus, for all image clusters. The goal of the feature is to add support of other compression methods to qcow2. For example, ZSTD which is more effective on compression than ZLIB. The default compression is ZLIB. Images created with ZLIB compression type are backward compatible with older qemu versions. Adding of the compression type breaks a number of tests because now the compression type is reported on image creation and there are some changes in the qcow2 header in size and offsets. The tests are fixed in the following ways: * filter out compression_type for many tests * fix header size, feature table size and backing file offset affected tests: 031, 036, 061, 080 header_size +=8: 1 byte compression type 7 bytes padding feature_table += 48: incompatible feature compression type backing_file_offset += 56 (8 + 48 -> header_change + feature_table_change) * add "compression type" for test output matching when it isn't filtered affected tests: 049, 060, 061, 065, 082, 085, 144, 182, 185, 198, 206, 242, 255, 274, 280 Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> QAPI part: Acked-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200507082521.29210-2-dplotnikov@virtuozzo.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
172 lines
3.7 KiB
Plaintext
172 lines
3.7 KiB
Plaintext
Test 1
|
|
{"execute": "block-dirty-bitmap-add", "arguments": {"disabled": false, "granularity": 16384, "name": "bitmap-0", "node": "drive0", "persistent": false}}
|
|
{"return": {}}
|
|
wrote 262144/262144 bytes at offset 0
|
|
256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
|
qemu-img info dump:
|
|
|
|
image: TEST_IMG
|
|
file format: IMGFMT
|
|
virtual size: 1 MiB (1048576 bytes)
|
|
cluster_size: 65536
|
|
Format specific information:
|
|
compat: 1.1
|
|
compression type: zlib
|
|
lazy refcounts: false
|
|
refcount bits: 16
|
|
corrupt: false
|
|
|
|
No bitmap in JSON format output
|
|
|
|
Test 2
|
|
{"execute": "block-dirty-bitmap-add", "arguments": {"disabled": true, "granularity": 32768, "name": "bitmap-1", "node": "drive0", "persistent": true}}
|
|
{"return": {}}
|
|
wrote 262144/262144 bytes at offset 262144
|
|
256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
|
qemu-img info dump:
|
|
|
|
image: TEST_IMG
|
|
file format: IMGFMT
|
|
virtual size: 1 MiB (1048576 bytes)
|
|
cluster_size: 65536
|
|
Format specific information:
|
|
compat: 1.1
|
|
compression type: zlib
|
|
lazy refcounts: false
|
|
bitmaps:
|
|
[0]:
|
|
flags:
|
|
name: bitmap-1
|
|
granularity: 32768
|
|
refcount bits: 16
|
|
corrupt: false
|
|
|
|
The same bitmaps in JSON format:
|
|
[
|
|
{
|
|
"flags": [],
|
|
"granularity": 32768,
|
|
"name": "bitmap-1"
|
|
}
|
|
]
|
|
|
|
Test 3
|
|
{"execute": "block-dirty-bitmap-add", "arguments": {"disabled": false, "granularity": 65536, "name": "bitmap-2", "node": "drive0", "persistent": true}}
|
|
{"return": {}}
|
|
wrote 262144/262144 bytes at offset 524288
|
|
256 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|
|
|
|
qemu-img info dump:
|
|
|
|
image: TEST_IMG
|
|
file format: IMGFMT
|
|
virtual size: 1 MiB (1048576 bytes)
|
|
cluster_size: 65536
|
|
Format specific information:
|
|
compat: 1.1
|
|
compression type: zlib
|
|
lazy refcounts: false
|
|
bitmaps:
|
|
[0]:
|
|
flags:
|
|
name: bitmap-1
|
|
granularity: 32768
|
|
[1]:
|
|
flags:
|
|
[0]: auto
|
|
name: bitmap-2
|
|
granularity: 65536
|
|
refcount bits: 16
|
|
corrupt: false
|
|
|
|
The same bitmaps in JSON format:
|
|
[
|
|
{
|
|
"flags": [],
|
|
"granularity": 32768,
|
|
"name": "bitmap-1"
|
|
},
|
|
{
|
|
"flags": [
|
|
"auto"
|
|
],
|
|
"granularity": 65536,
|
|
"name": "bitmap-2"
|
|
}
|
|
]
|
|
|
|
Test 4
|
|
Checking "in-use" flag...
|
|
qemu-img info dump:
|
|
|
|
image: TEST_IMG
|
|
file format: IMGFMT
|
|
virtual size: 1 MiB (1048576 bytes)
|
|
cluster_size: 65536
|
|
Format specific information:
|
|
compat: 1.1
|
|
compression type: zlib
|
|
lazy refcounts: false
|
|
bitmaps:
|
|
[0]:
|
|
flags:
|
|
[0]: in-use
|
|
name: bitmap-1
|
|
granularity: 32768
|
|
[1]:
|
|
flags:
|
|
[0]: in-use
|
|
[1]: auto
|
|
name: bitmap-2
|
|
granularity: 65536
|
|
refcount bits: 16
|
|
corrupt: false
|
|
|
|
The same bitmaps in JSON format:
|
|
[
|
|
{
|
|
"flags": [
|
|
"in-use"
|
|
],
|
|
"granularity": 32768,
|
|
"name": "bitmap-1"
|
|
},
|
|
{
|
|
"flags": [
|
|
"in-use",
|
|
"auto"
|
|
],
|
|
"granularity": 65536,
|
|
"name": "bitmap-2"
|
|
}
|
|
]
|
|
|
|
Test 5
|
|
{"execute": "block-dirty-bitmap-add", "arguments": {"disabled": false, "granularity": 16384, "name": "bitmap-0", "node": "drive0", "persistent": true}}
|
|
{"return": {}}
|
|
Write an unknown bitmap flag '0x4' into a new QCOW2 image at offset 327695
|
|
qemu-img: Could not open 'TEST_IMG': Bitmap 'bitmap-0' doesn't satisfy the constraints
|
|
|
|
Unset the unknown bitmap flag '0x4' in the bitmap directory entry:
|
|
|
|
image: TEST_IMG
|
|
file format: IMGFMT
|
|
virtual size: 1 MiB (1048576 bytes)
|
|
cluster_size: 65536
|
|
Format specific information:
|
|
compat: 1.1
|
|
compression type: zlib
|
|
lazy refcounts: false
|
|
bitmaps:
|
|
[0]:
|
|
flags:
|
|
[0]: auto
|
|
name: bitmap-0
|
|
granularity: 16384
|
|
refcount bits: 16
|
|
corrupt: false
|
|
|
|
Test complete
|