qcow2: introduce compression type feature
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>
2020-05-07 11:25:18 +03:00
|
|
|
Formatting 'TEST_DIR/PID-base', fmt=qcow2 size=67108864 cluster_size=65536 lazy_refcounts=off refcount_bits=16 compression_type=zlib
|
2019-12-17 17:18:58 +03:00
|
|
|
|
|
|
|
=== Launch VM ===
|
|
|
|
Enabling migration QMP events on VM...
|
|
|
|
{"return": {}}
|
|
|
|
|
|
|
|
=== Migrate to file ===
|
|
|
|
{"execute": "migrate", "arguments": {"uri": "exec:cat > /dev/null"}}
|
|
|
|
{"return": {}}
|
|
|
|
{"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
|
|
|
{"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
|
|
|
{"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
|
|
|
|
|
|
|
VM is now stopped:
|
|
|
|
completed
|
|
|
|
{"execute": "query-status", "arguments": {}}
|
|
|
|
{"return": {"running": false, "singlestep": false, "status": "postmigrate"}}
|
|
|
|
|
|
|
|
=== Create a snapshot of the disk image ===
|
|
|
|
{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "file", "filename": "TEST_DIR/PID-top", "size": 0}}}
|
|
|
|
{"return": {}}
|
|
|
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
|
|
|
{"return": {}}
|
|
|
|
|
|
|
|
{"execute": "blockdev-add", "arguments": {"driver": "file", "filename": "TEST_DIR/PID-top", "node-name": "top-file"}}
|
|
|
|
{"return": {}}
|
|
|
|
{"execute": "blockdev-create", "arguments": {"job-id": "job0", "options": {"driver": "qcow2", "file": "top-file", "size": 1048576}}}
|
|
|
|
{"return": {}}
|
|
|
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
|
|
|
{"return": {}}
|
|
|
|
|
|
|
|
{"execute": "blockdev-add", "arguments": {"driver": "qcow2", "file": "top-file", "node-name": "top-fmt"}}
|
|
|
|
{"return": {}}
|
|
|
|
{"execute": "blockdev-snapshot", "arguments": {"node": "base-fmt", "overlay": "top-fmt"}}
|
|
|
|
{"return": {}}
|
|
|
|
|
|
|
|
=== Resume the VM and simulate a write request ===
|
|
|
|
{"execute": "cont", "arguments": {}}
|
|
|
|
{"return": {}}
|
|
|
|
{"return": ""}
|
|
|
|
|
|
|
|
=== Commit it to the backing file ===
|
|
|
|
{"execute": "block-commit", "arguments": {"auto-dismiss": false, "device": "top-fmt", "job-id": "job0", "top-node": "top-fmt"}}
|
|
|
|
{"return": {}}
|
|
|
|
{"execute": "job-complete", "arguments": {"id": "job0"}}
|
|
|
|
{"return": {}}
|
|
|
|
{"data": {"device": "job0", "len": 65536, "offset": 65536, "speed": 0, "type": "commit"}, "event": "BLOCK_JOB_READY", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
|
|
|
{"data": {"device": "job0", "len": 65536, "offset": 65536, "speed": 0, "type": "commit"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}}
|
|
|
|
{"execute": "job-dismiss", "arguments": {"id": "job0"}}
|
|
|
|
{"return": {}}
|